8#include <private/qsgadaptationlayer_p.h>
9#include <private/qsgdistancefieldglyphnode_p.h>
10#include <private/qquickclipnode_p.h>
11#include <private/qquickitem_p.h>
12#include <private/qquicktextdocument_p.h>
13#include <QtQuick/private/qsgcontext_p.h>
15#include <QtCore/qpoint.h>
19#include <private/qquickstyledtext_p.h>
20#include <private/qquicktext_p_p.h>
21#include <private/qfont_p.h>
22#include <private/qfontengine_p.h>
24#include <private/qtextdocumentlayout_p.h>
35 : m_cursorNode(
nullptr), m_ownerElement(ownerElement), m_useNativeRenderer(
false), m_renderTypeQuality(-1)
37#ifdef QSG_RUNTIME_DESCRIPTION
53 bool preferNativeGlyphNode = m_useNativeRenderer;
54 if (!preferNativeGlyphNode) {
57 preferNativeGlyphNode =
true;
82 if (parentNode ==
nullptr)
107 if (m_cursorNode !=
nullptr)
120 m_cursorNode =
nullptr;
135 if (m_ownerElement->
smooth())
141 if (m_ownerElement->
smooth())
150 const QColor &anchorColor,
151 const QColor &selectionColor,
const QColor &selectedTextColor,
152 int selectionStart,
int selectionEnd)
155 engine.setTextColor(textColor);
156 engine.setSelectedTextColor(selectedTextColor);
157 engine.setSelectionColor(selectionColor);
158 engine.setAnchorColor(anchorColor);
167 engine.addFrameDecorations(textDocument, textFrame);
183 while (!
it.atEnd()) {
187 engine.addTextBlock(textDocument, block,
position, textColor, anchorColor, selectionStart, selectionEnd,
195 engine.addToSceneGraph(
this, style, styleColor);
200 const QColor &anchorColor,
201 const QColor &selectionColor,
const QColor &selectedTextColor,
202 int selectionStart,
int selectionEnd,
203 int lineStart,
int lineCount)
207 engine.setSelectedTextColor(selectedTextColor);
208 engine.setSelectionColor(selectionColor);
209 engine.setAnchorColor(anchorColor);
218 engine.mergeFormats(textLayout, &colorChanges);
226 lineCount = lineCount >= 0
230 bool inViewport =
false;
231 for (
int i=lineStart;
i<lineCount; ++
i) {
239 if (preeditPosition >= 0
240 && preeditPosition >=
start
241 && preeditPosition <
end) {
242 end += preeditLength;
246 if (!inViewport && !
viewport.isNull()) {
247 m_firstLineInViewport =
i;
248 qCDebug(lcVP) <<
"first line in viewport" <<
i <<
"@" <<
line.y();
252 engine.addGlyphsForRanges(colorChanges,
start,
end, selectionStart, selectionEnd);
253 }
else if (inViewport) {
255 m_firstLinePastViewport =
i;
256 qCDebug(lcVP) <<
"first omitted line past bottom of viewport" <<
i <<
"@" <<
line.y();
261 engine.addToSceneGraph(
this, style, styleColor);
268 m_cursorNode =
nullptr;
The QColor class provides colors based on RGB, HSV or CMYK values.
virtual bool hasUnreliableGlyphOutline() const
The QGlyphRun class provides direct access to the internal glyphs in a font.
QRawFont rawFont() const
Returns the font selected for this QGlyphRun object.
bool isEmpty() const noexcept
void append(parameter_type t)
\inmodule QtCore\reentrant
QSGRenderContext * sceneGraphRenderContext() const
static QQuickItemPrivate * get(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Flags flags() const
Returns the item flags for this item.
bool smooth
\qmlproperty bool QtQuick::Item::smooth
virtual QRectF clipRect() const
Returns the rectangular area within this item that is currently visible in \l viewportItem(),...
QSGGlyphNode * addGlyphs(const QPointF &position, const QGlyphRun &glyphs, const QColor &color, QQuickText::TextStyle style=QQuickText::Normal, const QColor &styleColor=QColor(), QSGNode *parentNode=0)
void addImage(const QRectF &rect, const QImage &image)
void addRectangleNode(const QRectF &rect, const QColor &color)
void setCursor(const QRectF &rect, const QColor &color)
void addTextLayout(const QPointF &position, QTextLayout *textLayout, const QColor &color=QColor(), QQuickText::TextStyle style=QQuickText::Normal, const QColor &styleColor=QColor(), const QColor &anchorColor=QColor(), const QColor &selectionColor=QColor(), const QColor &selectedTextColor=QColor(), int selectionStart=-1, int selectionEnd=-1, int lineStart=0, int lineCount=-1)
void addTextDocument(const QPointF &position, QTextDocument *textDocument, const QColor &color=QColor(), QQuickText::TextStyle style=QQuickText::Normal, const QColor &styleColor=QColor(), const QColor &anchorColor=QColor(), const QColor &selectionColor=QColor(), const QColor &selectedTextColor=QColor(), int selectionStart=-1, int selectionEnd=-1)
static const int largeTextSizeThreshold
static QRawFontPrivate * get(const QRawFont &font)
The QRawFont class provides access to a single physical instance of a font.
qreal ascent() const
Returns the ascent of this QRawFont in pixel units.
\inmodule QtCore\reentrant
const QSGGeometry * geometry() const
Returns this node's geometry.
virtual QSGInternalImageNode * createInternalImageNode(QSGRenderContext *renderContext)=0
virtual QSGGlyphNode * createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode, int renderTypeQuality)=0
QSGInternalRectangleNode * createInternalRectangleNode(const QRectF &rect, const QColor &c)
Convenience factory function for creating a colored rectangle with the given geometry.
void setRenderOrder(int order)
Sets the render order of this node to be order.
int renderOrder() const
Returns the render order of this geometry node.
void setVertexDataPattern(DataPattern p)
Sets the usage pattern for vertices to p.
void setIndexDataPattern(DataPattern p)
Sets the usage pattern for indices to p.
void setOwnerElement(QQuickItem *ownerElement)
virtual void setGlyphs(const QPointF &position, const QGlyphRun &glyphs)=0
virtual void setPreferredAntialiasingMode(AntialiasingMode)=0
virtual void setStyle(QQuickText::TextStyle style)=0
virtual void setColor(const QColor &color)=0
virtual void setStyleColor(const QColor &color)=0
virtual void setTexture(QSGTexture *texture)=0
virtual void setTargetRect(const QRectF &rect)=0
virtual void setFiltering(QSGTexture::Filtering filtering)=0
virtual void setInnerTargetRect(const QRectF &rect)=0
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
void removeChildNode(QSGNode *node)
Removes node from this node's list of children.
void appendChildNode(QSGNode *node)
Appends node to this node's list of children.
QSGNode * firstChild() const
Returns the first child of this node.
virtual QSGTexture * createTexture(const QImage &image, uint flags=CreateTexture_Alpha) const =0
QSGContext * sceneGraphContext() const
void setFiltering(Filtering filter)
Sets the sampling mode to filter.
qsizetype size() const
Returns the number of characters in this string.
QTextLayout * layout() const
Returns the QTextLayout that is used to lay out and display the block's contents.
int position() const
Returns the index of the block's first character within the document.
QTextBlock block() const
Returns the block that contains the cursor.
\reentrant \inmodule QtGui
QAbstractTextDocumentLayout * documentLayout() const
Returns the document layout for this document.
QTextFrame * rootFrame() const
Returns the document's root frame.
int characterCount() const
Position position() const
Returns the positioning policy for frames with this frame format.
int lastPosition() const
Returns the last document position inside the frame.
QList< QTextFrame * > childFrames() const
Returns a (possibly empty) list of the frame's child frames.
QTextFrameFormat frameFormat() const
Returns the frame's format.
iterator begin() const
Returns an iterator pointing to the first document element inside the frame.
int firstPosition() const
Returns the first document position inside the frame.
QTextCursor firstCursorPosition() const
Returns the first cursor position inside the frame.
QTextLine lineForTextPosition(int pos) const
Returns the line that contains the cursor position specified by pos.
int lineCount() const
Returns the number of lines in this text layout.
int preeditAreaPosition() const
Returns the position of the area in the text layout that will be processed before editing occurs.
QTextLine lineAt(int i) const
Returns the {i}-th line of text in this text layout.
QString preeditAreaText() const
Returns the text that is inserted in the layout before editing occurs.
qDeleteAll(list.begin(), list.end())
QSet< QString >::iterator it
Combined button and popup list for selecting options.
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
constexpr const T & qMin(const T &a, const T &b)
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLenum GLsizei length
GLint GLsizei GLsizei GLenum format
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
void qsgnode_set_description(QSGNode *node, const QString &description)
QLatin1StringView QLatin1String
view viewport() -> scroll(dx, dy, deviceRect)