OpenCoverage

qquicktext_p.h #1

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquicktext_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQuick module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#ifndef QQUICKTEXT_P_H-
41#define QQUICKTEXT_P_H-
42-
43//-
44// W A R N I N G-
45// --------------
46//-
47// This file is not part of the Qt API. It exists purely as an-
48// implementation detail. This header file may change from version to-
49// version without notice, or even be removed.-
50//-
51// We mean it.-
52//-
53-
54#include "qquickimplicitsizeitem_p.h"-
55#include <private/qtquickglobal_p.h>-
56#include <QtGui/qtextoption.h>-
57-
58QT_BEGIN_NAMESPACE-
59-
60class QQuickTextPrivate;-
61class QQuickTextLine;-
62class Q_QUICK_PRIVATE_EXPORT QQuickText : public QQuickImplicitSizeItem-
63{-
64 Q_OBJECT-
65-
66 Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)-
67 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)-
68 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)-
69 Q_PROPERTY(QColor linkColor READ linkColor WRITE setLinkColor NOTIFY linkColorChanged)-
70 Q_PROPERTY(TextStyle style READ style WRITE setStyle NOTIFY styleChanged)-
71 Q_PROPERTY(QColor styleColor READ styleColor WRITE setStyleColor NOTIFY styleColorChanged)-
72 Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged)-
73 Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged)-
74 Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged)-
75 Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged)-
76 Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged)-
77 Q_PROPERTY(bool truncated READ truncated NOTIFY truncatedChanged)-
78 Q_PROPERTY(int maximumLineCount READ maximumLineCount WRITE setMaximumLineCount NOTIFY maximumLineCountChanged RESET resetMaximumLineCount)-
79-
80 Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged)-
81 Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode NOTIFY elideModeChanged) //### elideMode?-
82 Q_PROPERTY(qreal contentWidth READ contentWidth NOTIFY contentSizeChanged)-
83 Q_PROPERTY(qreal contentHeight READ contentHeight NOTIFY contentSizeChanged)-
84 Q_PROPERTY(qreal paintedWidth READ contentWidth NOTIFY contentSizeChanged) // Compatibility-
85 Q_PROPERTY(qreal paintedHeight READ contentHeight NOTIFY contentSizeChanged)-
86 Q_PROPERTY(qreal lineHeight READ lineHeight WRITE setLineHeight NOTIFY lineHeightChanged)-
87 Q_PROPERTY(LineHeightMode lineHeightMode READ lineHeightMode WRITE setLineHeightMode NOTIFY lineHeightModeChanged)-
88 Q_PROPERTY(QUrl baseUrl READ baseUrl WRITE setBaseUrl RESET resetBaseUrl NOTIFY baseUrlChanged)-
89 Q_PROPERTY(int minimumPixelSize READ minimumPixelSize WRITE setMinimumPixelSize NOTIFY minimumPixelSizeChanged)-
90 Q_PROPERTY(int minimumPointSize READ minimumPointSize WRITE setMinimumPointSize NOTIFY minimumPointSizeChanged)-
91 Q_PROPERTY(FontSizeMode fontSizeMode READ fontSizeMode WRITE setFontSizeMode NOTIFY fontSizeModeChanged)-
92 Q_PROPERTY(RenderType renderType READ renderType WRITE setRenderType NOTIFY renderTypeChanged)-
93 Q_PROPERTY(QString hoveredLink READ hoveredLink NOTIFY linkHovered REVISION 2)-
94-
95 Q_PROPERTY(qreal padding READ padding WRITE setPadding RESET resetPadding NOTIFY paddingChanged REVISION 6)-
96 Q_PROPERTY(qreal topPadding READ topPadding WRITE setTopPadding RESET resetTopPadding NOTIFY topPaddingChanged REVISION 6)-
97 Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged REVISION 6)-
98 Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged REVISION 6)-
99 Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged REVISION 6)-
100-
101 Q_PROPERTY(QJSValue fontInfo READ fontInfo NOTIFY fontInfoChanged REVISION 9)-
102 Q_PROPERTY(QSizeF advance READ advance NOTIFY contentSizeChanged REVISION 10)-
103-
104public:-
105 QQuickText(QQuickItem *parent=nullptr);-
106 ~QQuickText() override;-
107-
108 enum HAlignment { AlignLeft = Qt::AlignLeft,-
109 AlignRight = Qt::AlignRight,-
110 AlignHCenter = Qt::AlignHCenter,-
111 AlignJustify = Qt::AlignJustify };-
112 Q_ENUM(HAlignment)-
113 enum VAlignment { AlignTop = Qt::AlignTop,-
114 AlignBottom = Qt::AlignBottom,-
115 AlignVCenter = Qt::AlignVCenter };-
116 Q_ENUM(VAlignment)-
117 enum TextStyle { Normal,-
118 Outline,-
119 Raised,-
120 Sunken };-
121 Q_ENUM(TextStyle)-
122 enum TextFormat { PlainText = Qt::PlainText,-
123 RichText = Qt::RichText,-
124 AutoText = Qt::AutoText,-
125 StyledText = 4 };-
126 Q_ENUM(TextFormat)-
127 enum TextElideMode { ElideLeft = Qt::ElideLeft,-
128 ElideRight = Qt::ElideRight,-
129 ElideMiddle = Qt::ElideMiddle,-
130 ElideNone = Qt::ElideNone };-
131 Q_ENUM(TextElideMode)-
132-
133 enum WrapMode { NoWrap = QTextOption::NoWrap,-
134 WordWrap = QTextOption::WordWrap,-
135 WrapAnywhere = QTextOption::WrapAnywhere,-
136 WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere, // COMPAT-
137 Wrap = QTextOption::WrapAtWordBoundaryOrAnywhere-
138 };-
139 Q_ENUM(WrapMode)-
140-
141 enum RenderType { QtRendering,-
142 NativeRendering-
143 };-
144 Q_ENUM(RenderType)-
145-
146 enum LineHeightMode { ProportionalHeight, FixedHeight };-
147 Q_ENUM(LineHeightMode)-
148-
149 enum FontSizeMode { FixedSize = 0x0, HorizontalFit = 0x01, VerticalFit = 0x02,-
150 Fit = HorizontalFit | VerticalFit };-
151 Q_ENUM(FontSizeMode)-
152-
153 QString text() const;-
154 void setText(const QString &);-
155-
156 QFont font() const;-
157 void setFont(const QFont &font);-
158-
159 QColor color() const;-
160 void setColor(const QColor &c);-
161-
162 QColor linkColor() const;-
163 void setLinkColor(const QColor &color);-
164-
165 TextStyle style() const;-
166 void setStyle(TextStyle style);-
167-
168 QColor styleColor() const;-
169 void setStyleColor(const QColor &c);-
170-
171 HAlignment hAlign() const;-
172 void setHAlign(HAlignment align);-
173 void resetHAlign();-
174 HAlignment effectiveHAlign() const;-
175-
176 VAlignment vAlign() const;-
177 void setVAlign(VAlignment align);-
178-
179 WrapMode wrapMode() const;-
180 void setWrapMode(WrapMode w);-
181-
182 int lineCount() const;-
183 bool truncated() const;-
184-
185 int maximumLineCount() const;-
186 void setMaximumLineCount(int lines);-
187 void resetMaximumLineCount();-
188-
189 TextFormat textFormat() const;-
190 void setTextFormat(TextFormat format);-
191-
192 TextElideMode elideMode() const;-
193 void setElideMode(TextElideMode);-
194-
195 qreal lineHeight() const;-
196 void setLineHeight(qreal lineHeight);-
197-
198 LineHeightMode lineHeightMode() const;-
199 void setLineHeightMode(LineHeightMode);-
200-
201-
202 QUrl baseUrl() const;-
203 void setBaseUrl(const QUrl &url);-
204 void resetBaseUrl();-
205-
206 int minimumPixelSize() const;-
207 void setMinimumPixelSize(int size);-
208-
209 int minimumPointSize() const;-
210 void setMinimumPointSize(int size);-
211-
212 FontSizeMode fontSizeMode() const;-
213 void setFontSizeMode(FontSizeMode mode);-
214-
215 void componentComplete() override;-
216-
217 int resourcesLoading() const; // mainly for testing-
218-
219 qreal contentWidth() const;-
220 qreal contentHeight() const;-
221-
222 QRectF boundingRect() const override;-
223 QRectF clipRect() const override;-
224 Q_INVOKABLE void doLayout(); // ### Qt 6: remove-
225 Q_REVISION(9) Q_INVOKABLE void forceLayout();-
226-
227 RenderType renderType() const;-
228 void setRenderType(RenderType renderType);-
229-
230 QString hoveredLink() const;-
231-
232 Q_REVISION(3) Q_INVOKABLE QString linkAt(qreal x, qreal y) const;-
233-
234 qreal padding() const;-
235 void setPadding(qreal padding);-
236 void resetPadding();-
237-
238 qreal topPadding() const;-
239 void setTopPadding(qreal padding);-
240 void resetTopPadding();-
241-
242 qreal leftPadding() const;-
243 void setLeftPadding(qreal padding);-
244 void resetLeftPadding();-
245-
246 qreal rightPadding() const;-
247 void setRightPadding(qreal padding);-
248 void resetRightPadding();-
249-
250 qreal bottomPadding() const;-
251 void setBottomPadding(qreal padding);-
252 void resetBottomPadding();-
253-
254 QJSValue fontInfo() const;-
255 QSizeF advance() const;-
256-
257Q_SIGNALS:-
258 void textChanged(const QString &text);-
259 void linkActivated(const QString &link);-
260 Q_REVISION(2) void linkHovered(const QString &link);-
261 void fontChanged(const QFont &font);-
262 void colorChanged();-
263 void linkColorChanged();-
264 void styleChanged(QQuickText::TextStyle style);-
265 void styleColorChanged();-
266 void horizontalAlignmentChanged(QQuickText::HAlignment alignment);-
267 void verticalAlignmentChanged(QQuickText::VAlignment alignment);-
268 void wrapModeChanged();-
269 void lineCountChanged();-
270 void truncatedChanged();-
271 void maximumLineCountChanged();-
272 void textFormatChanged(QQuickText::TextFormat textFormat);-
273 void elideModeChanged(QQuickText::TextElideMode mode);-
274 void contentSizeChanged();-
275 void lineHeightChanged(qreal lineHeight);-
276 void lineHeightModeChanged(LineHeightMode mode);-
277 void fontSizeModeChanged();-
278 void minimumPixelSizeChanged();-
279 void minimumPointSizeChanged();-
280 void effectiveHorizontalAlignmentChanged();-
281 void lineLaidOut(QQuickTextLine *line);-
282 void baseUrlChanged();-
283 void renderTypeChanged();-
284 Q_REVISION(6) void paddingChanged();-
285 Q_REVISION(6) void topPaddingChanged();-
286 Q_REVISION(6) void leftPaddingChanged();-
287 Q_REVISION(6) void rightPaddingChanged();-
288 Q_REVISION(6) void bottomPaddingChanged();-
289 Q_REVISION(9) void fontInfoChanged();-
290-
291protected:-
292 QQuickText(QQuickTextPrivate &dd, QQuickItem *parent = nullptr);-
293-
294 void mousePressEvent(QMouseEvent *event) override;-
295 void mouseReleaseEvent(QMouseEvent *event) override;-
296 void itemChange(ItemChange change, const ItemChangeData &value) override;-
297 void geometryChanged(const QRectF &newGeometry,-
298 const QRectF &oldGeometry) override;-
299 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;-
300-
301 void updatePolish() override;-
302-
303 void hoverEnterEvent(QHoverEvent *event) override;-
304 void hoverMoveEvent(QHoverEvent *event) override;-
305 void hoverLeaveEvent(QHoverEvent *event) override;-
306 void invalidateFontCaches();-
307-
308private Q_SLOTS:-
309 void q_updateLayout();-
310 void triggerPreprocess();-
311 void imageDownloadFinished();-
312-
313private:-
314 Q_DISABLE_COPY(QQuickText)-
315 Q_DECLARE_PRIVATE(QQuickText)
executed 3861929 times by 36 tests: return reinterpret_cast<QQuickTextPrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_bindingdependencyapi
  • tst_examples
  • tst_flickableinterop
  • tst_qqmlbinding
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlmetaobject
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlsqldatabase
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanchors
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickfocusscope
  • tst_qquickfontloader
  • tst_qquickfontloader_static
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • ...
executed 10487203 times by 36 tests: return reinterpret_cast<const QQuickTextPrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_bindingdependencyapi
  • tst_examples
  • tst_flickableinterop
  • tst_qqmlbinding
  • tst_qqmlecmascript
  • tst_qqmlenginedebugservice
  • tst_qqmlmetaobject
  • tst_qqmlproperty
  • tst_qqmlpropertymap
  • tst_qqmlsqldatabase
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanchors
  • tst_qquickanimations
  • tst_qquickbehaviors
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickfocusscope
  • tst_qquickfontloader
  • tst_qquickfontloader_static
  • tst_qquickgridview
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • ...
3861929-10487203
316};-
317-
318class QTextLine;-
319class QQuickTextLine : public QObject-
320{-
321 Q_OBJECT-
322 Q_PROPERTY(int number READ number)-
323 Q_PROPERTY(qreal width READ width WRITE setWidth)-
324 Q_PROPERTY(qreal height READ height WRITE setHeight)-
325 Q_PROPERTY(qreal x READ x WRITE setX)-
326 Q_PROPERTY(qreal y READ y WRITE setY)-
327-
328public:-
329 QQuickTextLine();-
330-
331 void setLine(QTextLine* line);-
332 void setLineOffset(int offset);-
333 int number() const;-
334-
335 qreal width() const;-
336 void setWidth(qreal width);-
337-
338 qreal height() const;-
339 void setHeight(qreal height);-
340-
341 qreal x() const;-
342 void setX(qreal x);-
343-
344 qreal y() const;-
345 void setY(qreal y);-
346-
347private:-
348 QTextLine *m_line;-
349 qreal m_height;-
350 int m_lineOffset;-
351};-
352-
353QT_END_NAMESPACE-
354-
355QML_DECLARE_TYPE(QQuickText)-
356QML_DECLARE_TYPE(QQuickTextLine)-
357-
358#endif // QQUICKTEXT_P_H-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0