2
votes

I have a single-color transparent PNG loaded with a QPixmap, I want to draw this pixmap multiple times using different colors (e.g. once green, another yellow, etc). These QPixmaps are rendered through QPainter in the paintEvent function of a QWidget.

1

1 Answers

0
votes

you can convert the pixmap into qimage and paint your own color .

1- Use QImage::fill(DesiredColor)

2- QPaintDevice supports QImage so use QPainter painter(&qImage); // 8 bit will not support in paint event .

then recreate QPixmap with image using QPixmap::fromImage(qImage);