|  | Home · Overviews · Examples |

# QPaintEngine Class Reference
[com.trolltech.qt.gui module]

The `QPaintEngine` class provides an abstract definition of how `QPainter` draws to a given device on a given platform. More...

## Detailed Description

The `QPaintEngine` class provides an abstract definition of how `QPainter` draws to a given device on a given platform.

Qt 4.0 provides several premade implementations of `QPaintEngine` for the different painter backends we support. We provide one paint engine for each window system and painting framework we support. This includes X11 on Unix/Linux and `CoreGraphics` on Mac OS X. In addition we provide `QPaintEngine` implementations for `OpenGL` (accessible through `QGLWidget`) and `PostScript` (accessible through QPSPrinter on X11). Additionally there is a raster-based paint engine that is a fallback for when an engine does not support a certain capability.

If one wants to use `QPainter` to draw to a different backend, one must subclass `QPaintEngine` and reimplement all its virtual functions. The `QPaintEngine` implementation is then made available by subclassing `QPaintDevice` and reimplementing the virtual function QPaintDevice::paintEngine().

`QPaintEngine` is created and owned by the `QPaintDevice` that created it.

The big advantage of the `QPaintEngine` approach opposed to Qt 3's `QPainter`/QPaintDevice::cmd() approach is that it is now possible to adapt to multiple technologies on each platform and take advantage of each to the fullest.

See also `QPainter`, `QPaintDevice::paintEngine`, and The Paint System.