[Qt-interest] Windows: Copy from Qt app into GIMP fails?

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Tue Feb 15 17:40:29 CET 2011


Hi,

somewhat a special use case, but did anyone ever succeed in copying image data from a Qt app into GIMP (www.gimp.org) on Windows?

Windows XP, Qt 4.7.1 MinGW binary distribution.


I have the following code:

QImage image(width, height, QImage::Format_ARGB32); // also tried with Format_RGB32, to no avail
...
QClipboard *clipboard = QApplication::clipboard();
QMimeData *mimeData = new QMimeData();
mimeData->setImageData(image);
clipboard->setMimeData(mimeData);

Whenever I try to paste this into Gimp I get the message "The clipboard does not contain any data which could be inserted". Copy/paste from my Qt application to any other application (MS Word, MS Paint, Paint.Net, LibreOffice, ...) works (except that the alpha channel seems to be dropped, but not sure whether that is a limitation of the Windows (XP) clipboard...). This somehow tells me that the error is more on the GIMP side - but what bugs me is that copy/paste works for other non-Qt applications, e.g. Firefox -> Gimp, MS Word -> Gimp, LibreOffice -> Gimp, ...

Also the same code above *does work* on Linux and even Mac (where GIMP is running with the help of the X11 support).

Anyone has any experience with that?

Thanks, Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22




More information about the Qt-interest-old mailing list