QPixmap / QImage

官方文档中是这样描述QPixmap和Image的:

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.

QPixmap是一种QPaintDevice, 依赖于所在平台的绘图引擎。

QImage也是一种QPaintDevice, 且与硬件无关的。我们可以通过它来直接获取和修改像素数据。

在这篇官方博客中也提到它们的区别:

QImage is designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen

QImage主要是为图像I/O, 像素获取和修改而设计。而QPixmap主要是为绘图,图像显示而设计。

由于QImage是硬件无关的,所以我们可以在单独的线程中操作它。而QPixmap则只能在主GUI线程进行操作。

QPicture

QPicture则是一个绘图装置,用于记录和重播QPainter的绘图指令.

QBitmap

QBitmap是QPixmap的一个子类,主要用于显示单色位图。

Reference