PDA

View Full Version : 4.4 back compatibility of the class QGraphicColorizeEffect



Snick
20th November 2009, 14:30
Hi all, the class QGraphicColorizeEffect let you change the color of a QgraphicPixmapItem,

unfortunatly this class was introduced only in 4.6,
i'm developing a project that must use the qt 4.3 so, i need to know how to change the color of a QGraphicPixmapItem

another issue is the setX and setY method on the QgraphicPixmapItem, again this was introduced only in 4.6 but looks like there wasn't any of similar on previous versions...


any tips ?!

wysota
20th November 2009, 17:15
I doubt you'll be able to mimic graphics effects easily. I can only advise you to create your own pixmap item class that would have a setColor() method that would take the original pixmap, colorize it so that you can draw it instead of the original. To colorize you can probably just set an appropriate composition mode and fill the pixmap with colour of your choice.

You should be able to implement setX and setY with a subclass as well, it's just a matter of returning a different bounding rect and a bit different painting routine.

Snick
21st November 2009, 00:00
an you pls tell me more about

" set an appropriate composition mode and fill the pixmap with colour of your choice "

is exactly what i need .. i have a gray figure, and want to set it with different colors ..



ps: i saw you wwWidget and i have to say they are super cool, great works, probably i will use the colorweel ;) so tnx in advice

wysota
21st November 2009, 00:02
an you pls tell me more about

" set an appropriate composition mode and fill the pixmap with colour of your choice "

is exactly what i need .. i have a gray figure, and want to set it with different colors ..


Open Qt Assistant and type in "composition" in the index tab.