When we talk about GUI frameworks, raster painting is usually associated with drawing on widgets. However, since Qt is something more than a GUI toolkit, the scope of raster painting that it offers is much broader.
In general, Qt's drawing architecture consists of three parts. The most important part is the device the drawing takes place on, represented by the QPaintDevice class. Qt provides a number of paint device subclasses, such as QWidget or QImage and QPrinter or QPdfWriter. You can see that the approach for drawing on a widget and printing on a printer is quite the same. The difference is in the second component of the architecture—the paint engine (QPaintEngine). The engine is responsible for performing the actual paint operations on a particular paint device. Different paint engines are used to draw on images and to print on printers. This...