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
qstatictext_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 QSTATICTEXT_P_H
5#define QSTATICTEXT_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 internal files. This header file may change from version to version
13// without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include "qstatictext.h"
20
21#include <private/qtextureglyphcache_p.h>
22#include <QtGui/qcolor.h>
23
25
26class Q_GUI_EXPORT QStaticTextUserData
27{
28public:
29 enum Type {
31 OpenGLUserData
32 };
33
35 virtual ~QStaticTextUserData();
36
39};
40
41class Q_GUI_EXPORT QStaticTextItem
42{
43public:
44 QStaticTextItem() : useBackendOptimizations(false),
45 userDataNeedsUpdate(0), usesRawFont(0),
46 m_fontEngine(nullptr), m_userData(nullptr) {}
47
49 {
50 m_userData = newUserData;
51 }
52 QStaticTextUserData *userData() const { return m_userData.data(); }
53
55 {
56 m_fontEngine = fe;
57 }
58
59 QFontEngine *fontEngine() const { return m_fontEngine.data(); }
60
61 union {
62 QFixedPoint *glyphPositions; // 8 bytes per glyph
64 };
65 union {
66 glyph_t *glyphs; // 4 bytes per glyph
68 };
69 // =================
70 // 12 bytes per glyph
71
72 // 8 bytes for pointers
73 int numGlyphs; // 4 bytes per item
74 QFont font; // 8 bytes per item
75 QColor color; // 10 bytes per item
76 char useBackendOptimizations : 1; // 1 byte per item
78 char usesRawFont : 1; //
79
80private: // private to avoid abuse
81 QExplicitlySharedDataPointer<QFontEngine> m_fontEngine; // 4 bytes per item
82 QExplicitlySharedDataPointer<QStaticTextUserData> m_userData; // 8 bytes per item
83 // ================
84 // 43 bytes per item
85};
87
88class QStaticText;
90{
91public:
95
96 void init();
97 void paintText(const QPointF &pos, QPainter *p, const QColor &pen);
98
100 {
101 needsRelayout = true;
102 }
103
104 QAtomicInt ref; // 4 bytes per text
105
106 QString text; // 4 bytes per text
107 QFont font; // 8 bytes per text
108 qreal textWidth; // 8 bytes per text
109 QSizeF actualSize; // 16 bytes per text
110 QPointF position; // 16 bytes per text
111
112 QTransform matrix; // 80 bytes per text
113 QStaticTextItem *items; // 4 bytes per text
114 int itemCount; // 4 bytes per text
115
116 glyph_t *glyphPool; // 4 bytes per text
117 QFixedPoint *positionPool; // 4 bytes per text
118
119 QTextOption textOption; // 28 bytes per text
120
121 unsigned char needsRelayout : 1; // 1 byte per text
122 unsigned char useBackendOptimizations : 1;
123 unsigned char textFormat : 2;
124 unsigned char untransformedCoordinates : 1;
125 // ================
126 // 191 bytes per text
127
128 static QStaticTextPrivate *get(const QStaticText *q);
129};
130
132
133#endif // QSTATICTEXT_P_H
\inmodule QtCore
Definition qatomic.h:112
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\reentrant
Definition qfont.h:22
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore
Definition qsize.h:208
QFontEngine * fontEngine() const
char useBackendOptimizations
void setUserData(QStaticTextUserData *newUserData)
QFixedPoint * glyphPositions
QStaticTextUserData * userData() const
void setFontEngine(QFontEngine *fe)
unsigned char textFormat
unsigned char useBackendOptimizations
QTextOption textOption
unsigned char needsRelayout
QFixedPoint * positionPool
QStaticTextItem * items
unsigned char untransformedCoordinates
The QStaticText class enables optimized drawing of text when the text and its layout is updated rarel...
Definition qstatictext.h:21
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\reentrant
Definition qtextoption.h:18
The QTransform class specifies 2D transformations of a coordinate system.
Definition qtransform.h:20
Combined button and popup list for selecting options.
static QDBusError::ErrorType get(const char *name)
GLenum type
GLint ref
GLdouble GLdouble t
Definition qopenglext.h:243
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLfloat GLfloat p
[1]
#define Q_AUTOTEST_EXPORT
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)
unsigned int glyph_t
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:158
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:180
double qreal
Definition qtypes.h:187
QObject::connect nullptr
QSharedPointer< T > other(t)
[5]
Definition moc.h:23