QClipboard: Image alpha channel support?
-
On Windows 8, Qt 5.2.1, I have a QImage with alpha channel and I want to put this image into the system clipboard:
QClipboard *clipboard =QApplication::clipboard();
QImage image(w, h, QImage::Format_ARGB32);
...
QMimeData *mimeData = new QMimeData();
mimeData->setImageData(image);
clipboard->setMimeData(mimeData);Can QClipboard support image with alpha channel in Qt 5.2.1?
-
Hi and welcome to devnet,
I know the question might sound silly but, did you try and it failed ?
-
QClipboard *clipboard =QApplication::clipboard();
QImage image(w, h, QImage::Format_ARGB32);
QMimeData *mimeData = new QMimeData();
mimeData->setImageData(image);
clipboard->setMimeData(mimeData);I Use above code in program, and then paste this image into e.g. OpenOffice Draw or MS PowerPoint the background which is supposed to be fully transparent is black and everything is fully opaque.
Can anyone confirm whether alpha channels in the clipboard are supported at all?
-
If you are using it as is, then i won't work, you are copying an uninitialized image. At least fill it with transparency before putting it in the QMimeData
On a side note, please enclose your code with coding tags (one @ at the beginning and one at the end) it will make it readable.