
You can also twist the coordinate system around the origin using the QPainter::shear() function. If you set QPainter's anti-aliasing render hint, the pixels will be rendered symmetrically on both sides of the mathematically defined points: We recommend that you simply use QRectF instead: The QRectF class defines a rectangle in the plane using floating point coordinates for accuracy ( QRect uses integer coordinates), and the QRectF::right() and QRectF::bottom() functions do return the true bottom-right corner.Īlternatively, using QRect, apply x() + width() and y() + height() to find the bottom-right corner, and avoid the right() and bottom() functions. The bottom-right green point in the diagrams shows the return coordinates of these functions. QRect's right() function returns left() + width() - 1 and the bottom() function returns top() + height() - 1. Note that for historical reasons the return value of the QRect::right() and QRect::bottom() functions deviate from the true bottom-right corner of the rectangle. The size (width and height) of a graphics primitive always correspond to its mathematical model, ignoring the width of the pen it is rendered with: QPainter also supports coordinate transformations (e.g. The logical and physical coordinate systems coincide by default. The mapping of the logical QPainter coordinates to the physical QPaintDevice coordinates are handled by QPainter's transformation matrix, viewport and "window". The default unit is one pixel on pixel-based devices and one point (1/72 of an inch) on printers. The x values increase to the right and the y values increase downwards. The default coordinate system of a paint device has its origin at the top-left corner. The QPaintDevice class is the base class of objects that can be painted: Its drawing capabilities are inherited by the QWidget, QImage, QPixmap, QPicture, and QOpenGLPaintDevice classes. QPainter is used to perform drawing operations, QPaintDevice is an abstraction of a two-dimensional space that can be painted on using a QPainter, and QPaintEngine provides the interface that the painter uses to draw onto different types of devices.

Together with the QPaintDevice and QPaintEngine classes, QPainter form the basis of Qt's painting system, Arthur.

The coordinate system is controlled by the QPainter class.
