|  | Home · All Classes · Main Classes · Annotated · Grouped Classes · Functions |

# QPaintDevice Class Reference

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.

- List of all members, including inherited members
- Qt 3 support members

### Public Functions

- virtual ~QPaintDevice ()
- int depth () const
- int height () const
- int heightMM () const
- int logicalDpiX () const
- int logicalDpiY () const
- int numColors () const
- virtual QPaintEngine * paintEngine () const = 0
- bool paintingActive () const
- int width () const
- int widthMM () const

### Protected Functions

- QPaintDevice ()

## Detailed Description

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, QImage, 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().

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.

## Member Function Documentation

### QPaintDevice::QPaintDevice () `[protected]`

Constructs a paint device. This constructor can be invoked only from subclasses of QPaintDevice.

### QPaintDevice::~QPaintDevice () `[virtual]`

Destroys the paint device and frees window system resources.

### int QPaintDevice::depth () const

Returns the bit depth (number of bit planes) of the paint device.

### int QPaintDevice::height () const

Returns the height of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

### int QPaintDevice::heightMM () const

Returns the height of the paint device in millimeters.

### int QPaintDevice::logicalDpiX () const

Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from widthMM(), but it varies on Windows.

### int QPaintDevice::logicalDpiY () const

Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from heightMM(), but it varies on Windows.

### int QPaintDevice::numColors () const

Returns the number of different colors available for the paint device. Since this value is an int, it will not be sufficient to represent the number of colors on 32 bit displays, in this case INT_MAX is returned instead.

### QPaintEngine * QPaintDevice::paintEngine () const `[pure virtual]`

Returns a pointer to the paint engine used for drawing on the device.

### bool QPaintDevice::paintingActive () const

Returns true if the device is currently being painted on, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false.

See also QPainter::isActive().

### int QPaintDevice::width () const

Returns the width of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

### int QPaintDevice::widthMM () const

Returns the width of the paint device in millimeters.