qt文档中对qimage和qpixmap的比较解释
The QImage class provides a hardware-independent pixmap representation with direct access to the pixel data.
It is one of the two classes Qt provides for dealing with images, the other being QPixmap. QImage is designed and optimized for I/O and for direct pixel access/manipulation. QPixmap is designed and optimized for drawing. There are (slow) functions to convert between QImage and QPixmap: QPixmap::convertToImage() and QPixmap::convertFromImage().
One common use of the QPixmap class is to enable smooth updating of widgets. Whenever something complex needs to be drawn, you can use a pixmap to obtain flicker-free drawing, like this:
Create a pixmap with the same size as the widget.
Fill the pixmap with the widget background color.
Paint the pixmap.
bitBlt() the pixmap contents onto the widget.
对照文档的解释,再看看两个类分别提供的函数,我的理解是:
1. 二者功能有重叠部分,如都可以获得height, width等参数;
2. 如果想对图片的内容进行加工处理,使用qpixmap+qpainter;
3. 如果是把图片当作一个整体来操作,如放大缩小,使用qimage.