Home > Mobile >  How to modify the QPixmap (const char * const [] XPM) constructor generated primitive color
How to modify the QPixmap (const char * const [] XPM) constructor generated primitive color

Time:01-23

How to modify the QPixmap (const char * const [] XPM) constructor generated primitive colors,

CodePudding user response:

QPixmap is designed to show the optimization, does not support pixel modified QImage is used for I/O and pixel read/modify
You want to change some pixels, use first toImage into QImage, then can use QImage: : setPixel or QImage: : setPixelColor modify individual pixel color
I finished to use QPixmap: : fromImage from QImage to QPixmap
Or if you do not need to modify the former QPixmap, you can also directly by the QImage (const char * const [] XPM) to create a QImage
  •  Tags:  
  • Qt
  • Related