Change colour of QPixmap?
I have a PNG image which contains a circle filled in white colour and the background is transparent.
I want to use this image as an icon in my application.
I want to allow the user to be able to change the colour of the circle (currently white) to his own.
I have added a QLabel and set its pixmap property to the PNG file in my resources.
I have the required colour as a QColor.
Now, how do I modify the QPixmap so that only the white colour is changed and the background colour remains transparent?
Since it doesn't seem to be a very complicated drawing, why not generate the pixmap directly in code ?
I mentioned the circle just for simplifying the question.
My actual image is much more complicated than that.
Also, since the colour is decided by the user at run time, I cannot prepare the images already...
You can search for the white pixel in the image and set the color you want.