![]() |
Home · All Classes · Main Classes · Annotated · Grouped Classes · Functions | ![]() |
The QPaintDevice class is the base class of objects that can be painted. More...
#include <QPaintDevice>
Part of the QtGui module.
Inherited by QImage, QPicture, QPixmap, QPrinter, and QWidget.
The QPaintDevice class is the base class of objects that can be painted.
A paint device is an abstraction of a two-dimensional space that can be drawn using a QPainter. The drawing capabilities are implemented by the subclasses QWidget, QPixmap, QPicture and QPrinter.
The default coordinate system of a paint device has its origin located at the top-left position. X increases to the right and Y increases downward. The unit is one pixel. There are several ways to set up a user-defined coordinate system using the painter, for example, using QPainter::setMatrix().
Example (draw on a paint device):
void MyWidget::paintEvent(QPaintEvent *) { QPainter painter; painter.begin(this); painter.setPen(Qt::red); painter.setBrush(Qt::yellow); painter.drawEllipse(10, 20, 100, 100); painter.end(); }
The bit block transfer is an extremely useful operation for copying pixels from one paint device to another (or to itself). It is implemented as the global function bitBlt().
Warning: Qt requires that a QApplication object exists before any paint devices can be created. Paint devices access window system resources, and these resources are not initialized before an application object is created.
Constructs a paint device with internal flags devflags. This constructor can be invoked only from QPaintDevice subclasses.
Destroys the paint device and frees window system resources.
Returns the bit depth (number of bit planes) of the paint device.
Returns the height of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).
Returns the height of the paint device, measured in millimeters.
Returns true if the device is an external paint device; otherwise returns false.
External paint devices cannot be bitBlt()'ed from. QPicture and QPrinter are external paint devices.
Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X, this is usually the same as could be computed from widthMM(), but it varies on Windows.
Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X, this is usually the same as could be computed from heightMM(), but it varies on Windows.
Returns the number of different colors available for the paint device. Since this value is an int will not be sufficient to represent the number of colors on 32 bit displays, in which case INT_MAX is returned instead.
Returns a pointer to the paint engine used for drawing on the device.
Returns true if the device is being painted, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false.
See also QPainter::isActive().
Returns the width of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).
Returns the width of the paint device, measured in millimeters.
Copyright © 2005 Trolltech | Trademarks | Qt 4.0.0-b2 |