在main中初始化,傳給處理模塊:
ClipBoardManagement clipboardManager;
clipboardManager.Init(QApplication::clipboard());
取剪切板的照片:利用信號dataChanged,來即時處理;
void ClipBoardManagement::TakeImage()
{
connect(clipboard_,&QClipboard::dataChanged,this,[&](){
const QMimeData *mimeData = clipboard_->mimeData();
QImage img = qvariant_cast<QImage>(mimeData->imageData());
qDebug()<<"get a image";
emit sig_nameImage(img);
});
}