QClipboard, pasting image on linux, how does it work
-
Hi there,
i am trying to paste an image in my Qt 5.0.2 application with this code:
[code]
QClipboard *clipboard = QApplication::clipboard();
const QMimeData *mimeData = clipboard->mimeData();if (mimeData->hasImage()) {
qDebug() << mimeData->imageData();
QImage image = qvariant_cast<QImage>(mimeData->imageData());
qDebug() << "pasted " << image.width();
}
[/code]So on linux running xfce desktop, i open the gimp, open a image, ctrl+a, ctrl+c, then go to my application and paste. What happens is: Gimp suddenly closes and debug output says:
[code]
QVariant(QImage, QImage(QSize(0, 0) ) )
pasted 0
[/code]Also tried a screenshot tool instead of gimp, no image pasting, as the screenshot tool automatically closes when you say 'copy to clipboard', i can not say if it would crash too.
What am i doing wrong?