QPixmap and QPainter (Qt 5)
-
So i am painting some QPixmaps in widget's PaintEvent using QPainter, and i want to change one color on all of them to trasparent. What is the best way to do it? I am porting my program from Qt 4, and there were method setAlphaChannel, but now i really don't know how to solve this problem. Tryed something like this
@
landscape[0].load("gfx/landscape/mount.bmp");
landscape[0].setMask(landscape[0].createMaskFromColor(QColor(100,100,100),Qt::MaskOutColor));
@But it doesn't work.
-
So solution was pretty easy using qimage i wrote:
@
landscape[0].load("gfx/landscape/mount.bmp");
landscape[0].setAlphaChannel(landscape[1].createMaskFromColor(qRgb(100,100,100),Qt::MaskOutColor));
@So this code makes currient rgb color for image transparent. Thank's.