QSGTextNode Class | Qt Quick (original) (raw)
The QSGTextNode class is a class for drawing text layouts and text documents in the Qt Quick scene graph. More...
Member Function Documentation
void QSGTextNode::addTextDocument(QPointF position, QTextDocument *document, int selectionStart = -1, int selectionCount = -1)
Adds the contents of document to the text node at position. If selectionStart is >= 0, then this marks the first character in a selected area of selectionCount number of characters. The selection is represented as a background fill with the selectionColor() and the selected text is rendered in the selectionTextColor().
This function forwards its arguments to the virtual function doAddTextDocument().
See also clear() and doAddTextDocument().
void QSGTextNode::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. If selectionStart is >= 0, then this marks the first character in a selected area of selectionCount number of characters. The selection is represented as a background fill with the selectionColor() and the selected text is rendered in the selectionTextColor().
For convenience, lineStart and lineCount can be used to select the range of QTextLine objects to include from the layout. This can be useful, for instance, when creating elided layouts. If lineCount is < 0, then the the node will include the lines from lineStart to the end of the layout.
This function forwards its arguments to the virtual function doAddTextLayout().
See also clear() and doAddTextLayout().
[pure virtual]
void QSGTextNode::clear()
Clears the contents of the node, deleting nodes and other data that represents the layouts and documents that have been added to it.
See also addTextLayout() and addTextDocument().
[pure virtual]
QColor QSGTextNode::color() const
Returns the main color used when rendering the text.
See also setColor().
[pure virtual]
QSGTexture::Filtering QSGTextNode::filtering() const
Returns the sampling mode used when scaling images that are part of the displayed text.
See also setFiltering().
[pure virtual]
QColor QSGTextNode::linkColor() const
Returns the color of hyperlinks in the text.
See also setLinkColor().
[pure virtual]
QSGTextNode::RenderType QSGTextNode::renderType() const
Returns the type of glyph node used for rendering the text.
See also setRenderType().
[pure virtual]
int QSGTextNode::renderTypeQuality() const
Returns the render type quality of the node. See setRenderTypeQuality() for details.
See also setRenderTypeQuality().
[pure virtual]
QColor QSGTextNode::selectionColor() const
Returns the color of the selection background when any part of the text is marked as selected.
See also setSelectionColor().
[pure virtual]
QColor QSGTextNode::selectionTextColor() const
Returns the color of the selection text when any part of the text is marked as selected.
See also setSelectionTextColor().
[pure virtual]
void QSGTextNode::setColor(QColor color)
Sets the main color to use when rendering the text to color.
The default is black: QColor(0, 0, 0)
.
See also color().
[pure virtual]
void QSGTextNode::setFiltering(QSGTexture::Filtering filtering)
Sets the sampling mode used when scaling images that are part of the displayed text to filtering. For smoothly scaled images, use QSGTexture::Linear here.
The default is QSGTexture::Nearest.
See also filtering().
[pure virtual]
void QSGTextNode::setLinkColor(QColor linkColor)
Sets the color of or hyperlinks to linkColor in the text.
The default is blue: QColor(0, 0, 255)
.
See also linkColor().
[pure virtual]
void QSGTextNode::setRenderType(QSGTextNode::RenderType renderType)
Sets the type of glyph node in use to renderType.
The default is QtRendering.
See also renderType().
[pure virtual]
void QSGTextNode::setRenderTypeQuality(int renderTypeQuality)
If the renderType() in use supports it, set the quality to use when rendering the text. When supported, this can be used to trade visual fidelity for execution speed or memory.
When the renderTypeQuality is < 0, the default quality is used.
The renderTypeQuality can be any integer, although limitations imposed by the underlying graphics hardware may be encountered if extreme values are set. The Qt Quick Text element operates with the following predefined values:
Constant | Description |
---|---|
DefaultRenderTypeQuality | -1 (default) |
LowRenderTypeQuality | 26 |
NormalRenderTypeQuality | 52 |
HighRenderTypeQuality | 104 |
VeryHighRenderTypeQuality | 208 |
This value is currently only respected by the QtRendering render type. Setting it changes the resolution of the distance fields used to represent the glyphs. Setting it above normal will cause memory consumption to increase, but reduces filtering artifacts on very large text.
The default is -1.
See also renderTypeQuality().
[pure virtual]
void QSGTextNode::setSelectionColor(QColor color)
Sets the color of the selection background to color when any part of the text is marked as selected.
The default is dark blue: QColor(0, 0, 128)
.
See also selectionColor().
[pure virtual]
void QSGTextNode::setSelectionTextColor(QColor selectionTextColor)
Sets the color of the selection text to selectionTextColor when any part of the text is marked as selected.
The default is white: QColor(255, 255, 255)
.
See also selectionTextColor().
[pure virtual]
void QSGTextNode::setStyleColor(QColor styleColor)
Sets the style color to use when rendering the text to styleColor.
The default is black: QColor(0, 0, 0)
.
See also styleColor() and setTextStyle().
[pure virtual]
void QSGTextNode::setTextStyle(QSGTextNode::TextStyle textStyle)
Sets the style of the rendered text to textStyle. The default is Normal
.
See also textStyle() and setStyleColor().
[pure virtual]
void QSGTextNode::setViewport(const QRectF &viewport)
Sets the bounding rect of the viewport where the text is displayed to viewport. Providing this information makes it possible for the QSGTextNode to optimize which parts of the text layout or document are included in the scene graph.
The default is a default-constructed QRectF. For this viewport, all contents will be included in the graph.
See also viewport().
[pure virtual]
QColor QSGTextNode::styleColor() const
Returns the style color used when rendering the text.
See also setStyleColor() and textStyle().
[pure virtual]
QSGTextNode::TextStyle QSGTextNode::textStyle()
Returns the style of the rendered text.
See also setTextStyle() and styleColor().
[pure virtual]
QRectF QSGTextNode::viewport() const
Returns the current viewport set for this QSGTextNode.
See also setViewport().