I do not understand what is the difference between QImage and QPixmap, they seem to offer the same functionality. When should I use a QImage and when should I use a QPixmap?
Easilly answered by reading the docs on QImage and QPixmap:
The QPixmap class is an off-screen image representation that can be used as a paint device. The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.
The QPixmap class is an off-screen image representation that can be used as a paint device.
The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.
Edit: Also, from @Dave's answer:
You can't manipulate a QPixmap outside the GUI-thread, but QImage has no such restriction.
And from @Arnold:
Here's a short summary that usually (not always) applies: If you plan to manipulate an image, modify it, change pixels on it, etc., use a QImage. If you plan to draw the same image more than once on the screen, convert it to a QPixmap.
Here's a short summary that usually (not always) applies:
2.1m questions
2.1m answers
60 comments
57.0k users