6.0.0-rc4Source

QPaintDevice Class

The QPaintDevice class is the base class of objects that QPainter can paint on. More…

Header#include <QPaintDevice>
CMaketarget_link_libraries(app PRIVATE Nt::Gui)
ModuleNt GUI C++ Classes
Inherited byQImage, QOpenGLPaintDevice, QPaintDeviceWindow, QPixmap, QSvgGenerator, QWidget

List of all members, including inherited members

Public Types

Public Functions

virtual ~QPaintDevice()
virtual QPaintEngine *paintEngine() const
intwidth() const
intheight() const
intwidthMM() const
intheightMM() const
intcolorCount() const
intdepth() const
intlogicalDpiX() const
intlogicalDpiY() const
qrealdevicePixelRatio() const
boolpaintingActive() const

Protected Functions

QPaintDevice()
virtual intmetric(PaintDeviceMetric metric) const
virtual QPaintDevice *redirected(QPoint *offset) const
virtual boolsystemClip(QRegion *region) const

Detailed Description

A paint device is a surface with a width, a height and a paint engine. QImage and the windows of Nt GUI are paint devices.

See also QPainter, QPaintEngine and QImage.

Differences from Qt

The device pixel ratio is always 1, and there is no colorCount() other than 16777216. The paint device does not need to be a QImage-sized object: any class that returns a paint engine can serve.

Member Type Documentation

enum QPaintDevice::PaintDeviceMetric

This enum describes the metrics that a paint device can report.

ConstantDescription
QPaintDevice::PdmWidthThe width in pixels.
QPaintDevice::PdmHeightThe height in pixels.
QPaintDevice::PdmWidthMMThe width in millimeters.
QPaintDevice::PdmHeightMMThe height in millimeters.
QPaintDevice::PdmNumColorsThe number of colors.
QPaintDevice::PdmDepthThe bit depth of a pixel.
QPaintDevice::PdmDpiXThe horizontal resolution in dots per inch.
QPaintDevice::PdmDpiYThe vertical resolution in dots per inch.
QPaintDevice::PdmDevicePixelRatioThe device pixel ratio, rounded down.
QPaintDevice::PdmDevicePixelRatioScaledThe device pixel ratio multiplied by 65536.

Member Function Documentation

[protected] QPaintDevice::QPaintDevice()

Constructs a paint device.

[virtual] QPaintDevice::~QPaintDevice()

Destroys the paint device.

int QPaintDevice::colorCount() const

Returns the number of colors the device supports.

int QPaintDevice::depth() const

Returns the number of bits per pixel.

qreal QPaintDevice::devicePixelRatio() const

Returns the number of device pixels that a unit of the device's coordinates stands for: 1 on an ordinary device and 2 on a high-resolution screen at twice the usual density. A QPainter scales what it draws by this factor.

int QPaintDevice::height() const

Returns the height of the device in pixels.

int QPaintDevice::heightMM() const

Returns the height of the device in millimeters.

int QPaintDevice::logicalDpiX() const

Returns the horizontal resolution in dots per inch.

int QPaintDevice::logicalDpiY() const

Returns the vertical resolution in dots per inch.

[virtual, protected] int QPaintDevice::metric(PaintDeviceMetric metric) const

Returns the value of metric. The default implementation reports a screen of 96 dots per inch and 32 bits per pixel, and 0 for the sizes.

[virtual] QPaintEngine * QPaintDevice::paintEngine() const

Returns the paint engine that paints on this device. A painter calls it when painting begins. The device owns the engine.

bool QPaintDevice::paintingActive() const

Returns true if a QPainter is painting on the device.

[virtual, protected] QPaintDevice * QPaintDevice::redirected(QPoint *offset) const

Returns the device that this device paints on, or nullptr if it paints on itself. A painter that begins on this device paints on the returned device instead, and the position of this device in it is added to offset. The default returns nullptr.

[virtual, protected] bool QPaintDevice::systemClip(QRegion *region) const

Returns true if painting on this device is restricted to a part of the device it is redirected to, and stores that part in region, in the coordinates of that device. A widget returns the part of its window that is visible and being painted. The default returns false.

See also redirected().

int QPaintDevice::width() const

Returns the width of the device in pixels.

int QPaintDevice::widthMM() const

Returns the width of the device in millimeters.