Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

What is the best way to overlay a color mask on a QGraphicsPixmapItem?



  • Hey,

    I have several QGraphicsPixmapItems and sometimes, some of them would need to become gray (for example). How can I do that without reloading each QPixmap? Reloading each QPixmap would be a very costly operation if you have many to handle, so I'd rather avoid this solution.

    Thanks!



  • That's a bit off-topic but how about loading two pixmaps but make one invisible until needed. That should be very fast.



  • @Wieland Although this is one solution, I would have to create beforehand a gray QPixmap for every QPixmap I plan to have. That would be very costly. Plus, I intent the mask to be oscillating between dark gray and light gray, so I would have to do that for every nuance of gray, for every QPixmap.


Log in to reply