[Qt-interest] Qpixmap::grabWidget format issue (Raphael Meloni)

chetan.jain at nokia.com chetan.jain at nokia.com
Thu Jun 25 11:48:02 CEST 2009


Hi,
 
>You can try this.
>
> >     QPixmap pixmap = QPixmap::grabWidget(view);
>
>       pixmap.save("test.png","PNG");
>       qDebug() << pixmap.hasAlphaChannel();
>
> >     QImage image = pixmap.toImage();

Thanks for your reply, I had tried something similar earlier but the grab was always returning RGB32 format image, resulting in the gray border on the convoluted image. Then we found that some of the images set on the PixmapItems were not actually in ARGB32_premultiplied format and when this view was grabbed, the result was not good.
Now we chk for the format and convert it to ARGB32_premultiplied before the grab and the results are excellent. 
Not sure if there is a more efficient way of doing this.

BR
Chetan



More information about the Qt-interest-old mailing list