The image depth is 32 but had not worked.
Qt Code:
qDebug()<<"depth "<<image.depth(); //prints 32 image.fill(qRgba(0, 0, 0, 255));To copy to clipboard, switch view to plain text mode
The image depth is 32 but had not worked.
Qt Code:
qDebug()<<"depth "<<image.depth(); //prints 32 image.fill(qRgba(0, 0, 0, 255));To copy to clipboard, switch view to plain text mode
how do you test if the image is transparent or not?
after the above code
//code in worker thread
Qt Code:
painter.save(); //painting is performed painter.restore();To copy to clipboard, switch view to plain text mode
//code in main gui thread.
Qt Code:
update();//inside the paintevent the pixmap is painted on to widget.To copy to clipboard, switch view to plain text mode
i get black as the background color.
But if any color is given(instead of Qt::transparent) such as green then green color is the background colorQt Code:
image.fill(colormap.pixel(Qt::green));To copy to clipboard, switch view to plain text mode
what are u trying to achieve ? I am still not clear abt it .
Are u making an application by which user can draw over a area, with an image in the bcground ??
Sort of image editing application ? am i getting u right ?
noSort of image editing application ?
A image is constructed(made) by painting on a QImage object with QPainter .Before painting on the image the image background should be set to transparent.
ohh oh !!!
I guess i caught the mistake...
255 specifies NO OPACITY !!image.fill(qRgba(0, 0, 0, 255)); should be
image.fill(qRgba(0, 0, 0, 0));
Hope this will solve the prob
thanks for reply
but it did not work
QImage::Format_RGB32 doesn't support transparency. Use QImage::Format_ARGB32
babu198649 (16th April 2008), Cupidvogel (13th February 2016)
thanks wysota
constructing the image with QImage::Format_ARGB32 and then using image.fill(qRgba(0,0,0,0));
makes the image transparent
Hi, sorry to bump this thread, but is it possible to make a QIcon out of an image where some parts are transparent, and then fill the opaque parts of the icon with some background color?
Bookmarks