Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qpaintdevice.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QPAINTDEVICE_H
5#define QPAINTDEVICE_H
6
7#include <QtGui/qtguiglobal.h>
8#include <QtGui/qwindowdefs.h>
9#include <QtCore/qrect.h>
10
12
13
14
15class QPaintEngine;
16
17class Q_GUI_EXPORT QPaintDevice // device for QPainter
18{
19public:
34
35 virtual ~QPaintDevice();
36
37 virtual int devType() const;
38 bool paintingActive() const;
39 virtual QPaintEngine *paintEngine() const = 0;
40
41 int width() const { return metric(PdmWidth); }
42 int height() const { return metric(PdmHeight); }
43 int widthMM() const { return metric(PdmWidthMM); }
44 int heightMM() const { return metric(PdmHeightMM); }
45 int logicalDpiX() const { return metric(PdmDpiX); }
46 int logicalDpiY() const { return metric(PdmDpiY); }
47 int physicalDpiX() const { return metric(PdmPhysicalDpiX); }
48 int physicalDpiY() const { return metric(PdmPhysicalDpiY); }
49 qreal devicePixelRatio() const { return metric(PdmDevicePixelRatioScaled) / devicePixelRatioFScale(); }
50 qreal devicePixelRatioF() const { return devicePixelRatio(); }
51 int colorCount() const { return metric(PdmNumColors); }
52 int depth() const { return metric(PdmDepth); }
53
54 static inline qreal devicePixelRatioFScale() { return 0x10000; }
55protected:
56 QPaintDevice() noexcept;
57 virtual int metric(PaintDeviceMetric metric) const;
58 virtual void initPainter(QPainter *painter) const;
59 virtual QPaintDevice *redirected(QPoint *offset) const;
60 virtual QPainter *sharedPainter() const;
61
62 ushort painters; // refcount
64 Q_DISABLE_COPY(QPaintDevice)
65
66 friend class QPainter;
67 friend class QPainterPrivate;
68 friend class QFontEngineMac;
69 friend class QX11PaintEngine;
70 friend Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, PaintDeviceMetric metric);
71};
72
73/*****************************************************************************
74 Inline functions
75 *****************************************************************************/
76
77inline int QPaintDevice::devType() const
79
81{ return painters != 0; }
82
84
85#endif // QPAINTDEVICE_H
IOBluetoothDevice * device
int logicalDpiX() const
bool paintingActive() const
qreal devicePixelRatio() const
int physicalDpiX() const
int depth() const
int logicalDpiY() const
int colorCount() const
int physicalDpiY() const
int width() const
int widthMM() const
qreal devicePixelRatioF() const
virtual QPaintEngine * paintEngine() const =0
int height() const
int heightMM() const
static qreal devicePixelRatioFScale()
\inmodule QtGui
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
\inmodule QtCore\reentrant
Definition qpoint.h:25
Combined button and popup list for selecting options.
GLenum GLuint GLintptr offset
Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, QPaintDevice::PaintDeviceMetric metric)
unsigned short ushort
Definition qtypes.h:33
double qreal
Definition qtypes.h:187
QPainter painter(this)
[7]