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
qpaintengine_p.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 QPAINTENGINE_P_H
5#define QPAINTENGINE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of other Qt classes. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include "QtGui/qpainter.h"
20#include "QtGui/qpaintengine.h"
21#include "QtGui/qregion.h"
22#include "private/qobject_p.h"
23
25
26class QPaintDevice;
27
28class Q_GUI_EXPORT QPaintEnginePrivate
29{
30 Q_DECLARE_PUBLIC(QPaintEngine)
31public:
32 QPaintEnginePrivate() : pdev(nullptr), q_ptr(nullptr), currentClipDevice(nullptr), hasSystemTransform(0),
33 hasSystemViewport(0) {}
34 virtual ~QPaintEnginePrivate();
35
46
47 inline void updateSystemClip()
48 {
49 systemClip = baseSystemClip;
50 if (systemClip.isEmpty())
51 return;
52
53 if (hasSystemTransform) {
54 if (systemTransform.type() <= QTransform::TxTranslate)
55 systemClip.translate(qRound(systemTransform.dx()), qRound(systemTransform.dy()));
56 else
57 systemClip = systemTransform.map(systemClip);
58 }
59
60 // Make sure we're inside the viewport.
61 if (hasSystemViewport) {
62 systemClip &= systemViewport;
63 if (systemClip.isEmpty()) {
64 // We don't want to paint without system clip, so set it to 1 pixel :)
65 systemClip = QRect(systemViewport.boundingRect().topLeft(), QSize(1, 1));
66 }
67 }
68 }
69
71 {
72 systemTransform = xform;
73 hasSystemTransform = !xform.isIdentity();
74 updateSystemClip();
75 if (q_ptr->state)
76 systemStateChanged();
77 }
78
79 inline void setSystemViewport(const QRegion &region)
80 {
81 systemViewport = region;
82 hasSystemViewport = !systemViewport.isEmpty();
83 updateSystemClip();
84 if (q_ptr->state)
85 systemStateChanged();
86 }
87
88 inline void setSystemTransformAndViewport(const QTransform &xform, const QRegion &region)
89 {
90 systemTransform = xform;
91 hasSystemTransform = !xform.isIdentity();
92 systemViewport = region;
93 hasSystemViewport = !systemViewport.isEmpty();
94 updateSystemClip();
95 if (q_ptr->state)
96 systemStateChanged();
97 }
98
99 virtual void systemStateChanged() { }
100
101 void drawBoxTextItem(const QPointF &p, const QTextItemInt &ti);
102
103 static QPaintEnginePrivate *get(QPaintEngine *paintEngine) { return paintEngine->d_func(); }
104
105 virtual QPaintEngine *aggregateEngine() { return nullptr; }
106 virtual Qt::HANDLE nativeHandle() { return nullptr; }
107};
108
110
111#endif // QPAINTENGINE_P_H
void setSystemViewport(const QRegion &region)
void setSystemTransform(const QTransform &xform)
QPaintDevice * currentClipDevice
QTransform systemTransform
static QPaintEnginePrivate * get(QPaintEngine *paintEngine)
virtual void systemStateChanged()
QPaintEngine * q_ptr
void setSystemTransformAndViewport(const QTransform &xform, const QRegion &region)
QPaintDevice * pdev
virtual Qt::HANDLE nativeHandle()
virtual QPaintEngine * aggregateEngine()
\inmodule QtGui
QPaintEngineState * state
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
Definition qrect.h:221
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
QRect boundingRect() const noexcept
Returns the bounding rectangle of this region.
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
\inmodule QtCore
Definition qsize.h:25
Internal QTextItem.
The QTransform class specifies 2D transformations of a coordinate system.
Definition qtransform.h:20
qreal dx() const
Returns the horizontal translation factor.
Definition qtransform.h:235
QPoint map(const QPoint &p) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
TransformationType type() const
Returns the transformation type of this matrix.
bool isIdentity() const
Returns true if the matrix is the identity matrix, otherwise returns false.
Definition qtransform.h:169
qreal dy() const
Returns the vertical translation factor.
Definition qtransform.h:239
Combined button and popup list for selecting options.
void * HANDLE
int qRound(qfloat16 d) noexcept
Definition qfloat16.h:327
GLfloat GLfloat p
[1]
unsigned int uint
Definition qtypes.h:34
QObject::connect nullptr