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
qsgtextnode.h
Go to the documentation of this file.
1// Copyright (C) 2023 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 QSGTEXTNODE_H
5#define QSGTEXTNODE_H
6
7#include <QtGui/qtextlayout.h>
8#include <QtQuick/qsgnode.h>
9#include <QtQuick/qsgtexture.h>
10
12
13class Q_QUICK_EXPORT QSGTextNode : public QSGTransformNode
14{
15public:
16 ~QSGTextNode() override;
17
18 // Should match the TextStyle in qquicktext_p.h
20 {
24 Sunken
25 };
26
27 // Should match the RenderType in qquicktext_p.h
29 {
32 CurveRendering
33 };
34
35 virtual void setColor(QColor color) = 0;
36 virtual QColor color() const = 0;
37
38 virtual void setTextStyle(TextStyle textStyle) = 0;
39 virtual TextStyle textStyle() = 0;
40
41 virtual void setStyleColor(QColor styleColor) = 0;
42 virtual QColor styleColor() const = 0;
43
44 virtual void setLinkColor(QColor linkColor) = 0;
45 virtual QColor linkColor() const = 0;
46
47 virtual void setSelectionColor(QColor selectionColor) = 0;
48 virtual QColor selectionColor() const = 0;
49
50 virtual void setSelectionTextColor(QColor selectionTextColor) = 0;
51 virtual QColor selectionTextColor() const = 0;
52
53 virtual void setRenderType(RenderType renderType) = 0;
54 virtual RenderType renderType() const = 0;
55
56 virtual void setRenderTypeQuality(int renderTypeQuality) = 0;
57 virtual int renderTypeQuality() const = 0;
58
60 virtual QSGTexture::Filtering filtering() const = 0;
61
62 virtual void clear() = 0;
63
64 virtual void setViewport(const QRectF &viewport) = 0;
65 virtual QRectF viewport() const = 0;
66
69 int selectionStart = -1,
70 int selectionCount = -1,
71 int lineStart = 0,
72 int lineCount = -1)
73 {
74 doAddTextLayout(position, layout, selectionStart, selectionCount, lineStart, lineCount);
75 }
76
78 QTextDocument *document,
79 int selectionStart = -1,
80 int selectionCount = -1)
81 {
82 doAddTextDocument(position, document, selectionStart, selectionCount);
83 }
84
85private:
88 int selectionStart,
89 int selectionCount,
90 int lineStart,
91 int lineCount) = 0;
93 QTextDocument *document,
94 int selectionStart,
95 int selectionCount) = 0;
96
97};
98
100
101#endif // QSGTEXTNODE_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore\reentrant
Definition qrect.h:484
The QSGTextNode class is a class for drawing text layouts and text documents in the Qt Quick scene gr...
Definition qsgtextnode.h:14
virtual QColor selectionTextColor() const =0
Returns the color of the selection text when any part of the text is marked as selected.
virtual void clear()=0
Clears the contents of the node, deleting nodes and other data that represents the layouts and docume...
virtual void setStyleColor(QColor styleColor)=0
Sets the style color to use when rendering the text to styleColor.
virtual void setSelectionTextColor(QColor selectionTextColor)=0
Sets the color of the selection text to selectionTextColor when any part of the text is marked as sel...
virtual void setLinkColor(QColor linkColor)=0
Sets the color of or hyperlinks to linkColor in the text.
virtual void setSelectionColor(QColor selectionColor)=0
Sets the color of the selection background to color when any part of the text is marked as selected.
void addTextLayout(QPointF position, QTextLayout *layout, int selectionStart=-1, int selectionCount=-1, int lineStart=0, int lineCount=-1)
Adds the contents of layout to the text node at position.
Definition qsgtextnode.h:67
virtual QColor selectionColor() const =0
Returns the color of the selection background when any part of the text is marked as selected.
virtual QColor styleColor() const =0
Returns the style color used when rendering the text.
virtual QColor linkColor() const =0
Returns the color of hyperlinks in the text.
virtual TextStyle textStyle()=0
Returns the style of the rendered text.
virtual QSGTexture::Filtering filtering() const =0
Returns the sampling mode used when scaling images that are part of the displayed text.
virtual void doAddTextDocument(QPointF position, QTextDocument *document, int selectionStart, int selectionCount)=0
Virtual function called by addTextDocument(), which converts the contents of document to scene graph ...
virtual int renderTypeQuality() const =0
Returns the render type quality of the node.
virtual void setViewport(const QRectF &viewport)=0
Sets the bounding rect of the viewport where the text is displayed to viewport.
virtual RenderType renderType() const =0
Returns the type of glyph node used for rendering the text.
void addTextDocument(QPointF position, QTextDocument *document, int selectionStart=-1, int selectionCount=-1)
Adds the contents of document to the text node at position.
Definition qsgtextnode.h:77
virtual void setFiltering(QSGTexture::Filtering)=0
Sets the sampling mode used when scaling images that are part of the displayed text to filtering.
virtual void setColor(QColor color)=0
Sets the main color to use when rendering the text to color.
virtual void doAddTextLayout(QPointF position, QTextLayout *layout, int selectionStart, int selectionCount, int lineStart, int lineCount)=0
Virtual function called by addTextLayout(), which converts the contents of layout to scene graph node...
virtual void setRenderType(RenderType renderType)=0
Sets the type of glyph node in use to renderType.
virtual QRectF viewport() const =0
Returns the current viewport set for this QSGTextNode.
RenderType
This enum type describes type of glyph node used for rendering the text.
Definition qsgtextnode.h:29
virtual void setRenderTypeQuality(int renderTypeQuality)=0
If the \l renderType() in use supports it, set the quality to use when rendering the text.
virtual QColor color() const =0
Returns the main color used when rendering the text.
virtual void setTextStyle(TextStyle textStyle)=0
Sets the style of the rendered text to textStyle.
~QSGTextNode() override
TextStyle
This enum type describes styles that can be applied to text rendering.
Definition qsgtextnode.h:20
Filtering
Specifies how sampling of texels should filter when texture coordinates are not pixel aligned.
Definition qsgtexture.h:34
The QSGTransformNode class implements transformations in the scene graph.
Definition qsgnode.h:241
\reentrant \inmodule QtGui
\reentrant
Definition qtextlayout.h:70
Combined button and popup list for selecting options.
GLuint color
[2]
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
unsigned char quint8
Definition qtypes.h:46
QVBoxLayout * layout
view viewport() -> scroll(dx, dy, deviceRect)