Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QQuickTextNodeEngine Class Reference

#include <qquicktextnodeengine_p.h>

+ Collaboration diagram for QQuickTextNodeEngine:

Classes

struct  BinaryTreeNode
 
struct  BinaryTreeNodeKey
 

Public Types

enum  Decoration {
  NoDecoration = 0x0 , Underline = 0x1 , Overline = 0x2 , StrikeOut = 0x4 ,
  Background = 0x8
}
 
enum  SelectionState { Unselected , Selected }
 

Public Member Functions

 QQuickTextNodeEngine ()
 
bool hasContents () const
 
void addTextBlock (QTextDocument *, const QTextBlock &, const QPointF &position, const QColor &textColor, const QColor &anchorColor, int selectionStart, int selectionEnd, const QRectF &viewport=QRectF())
 
QTextLine currentLine () const
 
void setCurrentLine (const QTextLine &currentLine)
 
void setCurrentTextDirection (Qt::LayoutDirection textDirection)
 
void addBorder (const QRectF &rect, qreal border, QTextFrameFormat::BorderStyle borderStyle, const QBrush &borderBrush)
 
void addFrameDecorations (QTextDocument *document, QTextFrame *frame)
 
void addImage (const QRectF &rect, const QImage &image, qreal ascent, SelectionState selectionState, QTextFrameFormat::Position layoutPosition)
 
int addText (const QTextBlock &block, const QTextCharFormat &charFormat, const QColor &textColor, const QVarLengthArray< QTextLayout::FormatRange > &colorChanges, int textPos, int fragmentEnd, int selectionStart, int selectionEnd)
 
void addTextObject (const QTextBlock &block, const QPointF &position, const QTextCharFormat &format, SelectionState selectionState, QTextDocument *textDocument, int pos, QTextFrameFormat::Position layoutPosition=QTextFrameFormat::InFlow)
 
void addSelectedGlyphs (const QGlyphRun &glyphRun)
 
void addUnselectedGlyphs (const QGlyphRun &glyphRun)
 
void addGlyphsInRange (int rangeStart, int rangeEnd, const QColor &color, const QColor &backgroundColor, const QColor &underlineColor, int selectionStart, int selectionEnd)
 
void addGlyphsForRanges (const QVarLengthArray< QTextLayout::FormatRange > &ranges, int start, int end, int selectionStart, int selectionEnd)
 
void mergeProcessedNodes (QList< BinaryTreeNode * > *regularNodes, QList< BinaryTreeNode * > *imageNodes)
 
void addToSceneGraph (QQuickTextNode *parent, QQuickText::TextStyle style=QQuickText::Normal, const QColor &styleColor=QColor())
 
void setSelectionColor (const QColor &selectionColor)
 
void setSelectedTextColor (const QColor &selectedTextColor)
 
void setTextColor (const QColor &textColor)
 
void setAnchorColor (const QColor &anchorColor)
 
void setPosition (const QPointF &position)
 

Friends

class QQuickTextNode
 

Detailed Description

Definition at line 34 of file qquicktextnodeengine_p.h.

Member Enumeration Documentation

◆ Decoration

Enumerator
NoDecoration 
Underline 
Overline 
StrikeOut 
Background 

Definition at line 36 of file qquicktextnodeengine_p.h.

◆ SelectionState

Enumerator
Unselected 
Selected 

Definition at line 45 of file qquicktextnodeengine_p.h.

Constructor & Destructor Documentation

◆ QQuickTextNodeEngine()

QQuickTextNodeEngine::QQuickTextNodeEngine ( )
inline

Definition at line 112 of file qquicktextnodeengine_p.h.

Member Function Documentation

◆ addBorder()

void QQuickTextNodeEngine::addBorder ( const QRectF rect,
qreal  border,
QTextFrameFormat::BorderStyle  borderStyle,
const QBrush borderBrush 
)

Definition at line 627 of file qquicktextnodeengine.cpp.

References QList< T >::append(), QBrush::color(), Q_UNUSED, qMakePair(), and rect.

Referenced by addFrameDecorations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addFrameDecorations()

void QQuickTextNodeEngine::addFrameDecorations ( QTextDocument document,
QTextFrame frame 
)

◆ addGlyphsForRanges()

void QQuickTextNodeEngine::addGlyphsForRanges ( const QVarLengthArray< QTextLayout::FormatRange > &  ranges,
int  start,
int  end,
int  selectionStart,
int  selectionEnd 
)

Definition at line 504 of file qquicktextnodeengine.cpp.

References addGlyphsInRange(), QVarLengthArray< T, Prealloc >::at(), QTextFormat::BackgroundBrush, QTextFormat::ForegroundBrush, j, qMin(), QVLABaseBase::size(), and QTextFormat::TextUnderlineColor.

Referenced by addText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addGlyphsInRange()

void QQuickTextNodeEngine::addGlyphsInRange ( int  rangeStart,
int  rangeEnd,
const QColor color,
const QColor backgroundColor,
const QColor underlineColor,
int  selectionStart,
int  selectionEnd 
)

Definition at line 552 of file qquicktextnodeengine.cpp.

References addSelectedGlyphs(), addUnselectedGlyphs(), QList< T >::at(), hasSelection(), QColor::isValid(), j, line, qMax(), qMin(), and QList< T >::size().

Referenced by addGlyphsForRanges().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addImage()

void QQuickTextNodeEngine::addImage ( const QRectF rect,
const QImage image,
qreal  ascent,
SelectionState  selectionState,
QTextFrameFormat::Position  layoutPosition 
)

Definition at line 392 of file qquicktextnodeengine.cpp.

References QTextLine::ascent(), QQuickTextNodeEngine::BinaryTreeNode::ascent, QQuickTextNodeEngine::BinaryTreeNode::boundingRect, QQuickTextNodeEngine::BinaryTreeNode::glyphRun, QTextFrameFormat::InFlow, QQuickTextNodeEngine::BinaryTreeNode::insert(), QGlyphRun::isRightToLeft(), QRectF::moveTopLeft(), QRectF::moveTopRight(), QTextLine::position(), QTextLine::rect(), rect, Qt::RightToLeft, QRectF::topLeft(), and QRectF::topRight().

Referenced by addTextObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSelectedGlyphs()

void QQuickTextNodeEngine::addSelectedGlyphs ( const QGlyphRun glyphRun)

Definition at line 490 of file qquicktextnodeengine.cpp.

References QQuickTextNodeEngine::BinaryTreeNode::insert(), NoDecoration, and Selected.

Referenced by addGlyphsInRange().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addText()

int QQuickTextNodeEngine::addText ( const QTextBlock block,
const QTextCharFormat charFormat,
const QColor textColor,
const QVarLengthArray< QTextLayout::FormatRange > &  colorChanges,
int  textPos,
int  fragmentEnd,
int  selectionStart,
int  selectionEnd 
)

Definition at line 131 of file qquicktextnodeengine.cpp.

References addGlyphsForRanges(), QBrush::color(), currentLine(), QTextFormat::foreground(), QTextBlock::layout(), line, QTextLayout::lineForTextPosition(), Qt::NoBrush, QTextBlock::position(), Q_ASSERT, qMin(), setCurrentLine(), setTextColor(), and QBrush::style().

Referenced by addTextBlock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTextBlock()

void QQuickTextNodeEngine::addTextBlock ( QTextDocument textDocument,
const QTextBlock block,
const QPointF position,
const QColor textColor,
const QColor anchorColor,
int  selectionStart,
int  selectionEnd,
const QRectF viewport = QRectF() 
)

Adds the block from the textDocument at position if its \l {QAbstractTextDocumentLayout::blockBoundingRect()}{bounding rect} intersects the viewport, or if viewport is not valid (i.e. use a default-constructed QRectF to skip the viewport check).

See also
QQuickItem::clipRect()

Definition at line 955 of file qquicktextnodeengine.cpp.

References addText(), addTextObject(), addUnselectedGlyphs(), QTextCharFormat::AlignSubScript, QTextCharFormat::AlignSuperScript, QList< T >::append(), QList< T >::at(), QTextBlock::iterator::atEnd(), QTextFormat::background(), QTextFormat::BackgroundBrush, QTextBlock::begin(), QAbstractTextDocumentLayout::blockBoundingRect(), QTextBlock::blockFormat(), QTextFormat::BlockTrailingHorizontalRulerWidth, QRectF::center(), QTextBlock::charFormat(), QTextFragment::charFormat(), QTextBlockFormat::Checked, QBrush::color(), QString::contains(), currentLine(), QTextDocument::documentLayout(), QTextCharFormat::font(), font, fontMetrics, QTextFormat::foreground(), QTextLayout::FormatRange::format, QTextBlock::iterator::fragment(), frame, QTextFormat::hasProperty(), i, QTextFrameFormat::InFlow, QRectF::intersects(), QTextCharFormat::isAnchor(), QString::isEmpty(), QTextLine::isValid(), QTextBlock::isValid(), layout, QTextBlock::layout(), Qt::LeftToRight, QTextLayout::FormatRange::length, QTextBlock::length(), QTextFragment::length(), line, QTextLayout::lineForTextPosition(), QTextListFormat::ListCircle, QTextListFormat::ListDecimal, QTextListFormat::ListLowerAlpha, QTextListFormat::ListLowerRoman, QTextListFormat::ListSquare, QTextListFormat::ListUpperAlpha, QTextListFormat::ListUpperRoman, QTextBlockFormat::marker(), QRectF::moveCenter(), QTextLine::naturalTextRect(), Qt::NoBrush, QTextBlockFormat::NoMarker, QTextDocument::objectForFormat(), QChar::ObjectReplacementCharacter, pos, QTextBlock::position(), position(), QTextLayout::preeditAreaPosition(), QTextLayout::preeditAreaText(), QTextFormat::property(), Q_ASSERT, qCDebug, qMakePair(), Qt::RightToLeft, Selected, setCurrentLine(), setCurrentTextDirection(), setPosition(), setTextColor(), QString::size(), QList< T >::size(), QTextLayout::FormatRange::start, QBrush::style(), QTextListFormat::style(), text, QTextFragment::text(), QTextBlock::textDirection(), QTextBlock::textList(), textRect, QTextFormat::TextUnderlineColor, QRect::topLeft(), QRectF::topLeft(), QRectF::translated(), QTextBlockFormat::Unchecked, Unselected, QTextCharFormat::verticalAlignment(), viewport(), QRect::width(), QRectF::width(), QRectF::x(), and QRectF::y().

◆ addTextObject()

void QQuickTextNodeEngine::addTextObject ( const QTextBlock block,
const QPointF position,
const QTextCharFormat format,
SelectionState  selectionState,
QTextDocument textDocument,
int  pos,
QTextFrameFormat::Position  layoutPosition = QTextFrameFormat::InFlow 
)

Definition at line 420 of file qquicktextnodeengine.cpp.

References addImage(), QTextCharFormat::AlignBaseline, QTextCharFormat::AlignBottom, QTextCharFormat::AlignMiddle, QTextCharFormat::AlignTop, QTextDocument::documentLayout(), QTextObjectInterface::drawObject(), QImage::Format_ARGB32_Premultiplied, QAbstractTextDocumentLayout::handlerForObject(), QTextImageHandler::image(), QTextFormat::ImageObject, QTextObjectInterface::intrinsicSize(), QTextBlock::layout(), line, QTextLayout::lineForTextPosition(), painter, pos, QTextBlock::position(), position(), QTextFormat::toImageFormat(), and Qt::transparent.

Referenced by addTextBlock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addToSceneGraph()

◆ addUnselectedGlyphs()

void QQuickTextNodeEngine::addUnselectedGlyphs ( const QGlyphRun glyphRun)

Definition at line 478 of file qquicktextnodeengine.cpp.

References QQuickTextNodeEngine::BinaryTreeNode::insert(), NoDecoration, and Unselected.

Referenced by addGlyphsInRange(), and addTextBlock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ currentLine()

QTextLine QQuickTextNodeEngine::currentLine ( ) const
inline

Definition at line 121 of file qquicktextnodeengine_p.h.

Referenced by addText(), addTextBlock(), and setCurrentLine().

+ Here is the caller graph for this function:

◆ hasContents()

bool QQuickTextNodeEngine::hasContents ( ) const
inline

Definition at line 118 of file qquicktextnodeengine_p.h.

◆ mergeProcessedNodes()

void QQuickTextNodeEngine::mergeProcessedNodes ( QList< BinaryTreeNode * > *  regularNodes,
QList< BinaryTreeNode * > *  imageNodes 
)

◆ setAnchorColor()

void QQuickTextNodeEngine::setAnchorColor ( const QColor anchorColor)
inline

Definition at line 182 of file qquicktextnodeengine_p.h.

◆ setCurrentLine()

void QQuickTextNodeEngine::setCurrentLine ( const QTextLine currentLine)
inline

Definition at line 123 of file qquicktextnodeengine_p.h.

References currentLine(), and QTextLine::isValid().

Referenced by addText(), and addTextBlock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCurrentTextDirection()

void QQuickTextNodeEngine::setCurrentTextDirection ( Qt::LayoutDirection  textDirection)
inline

Definition at line 131 of file qquicktextnodeengine_p.h.

Referenced by addTextBlock().

+ Here is the caller graph for this function:

◆ setPosition()

void QQuickTextNodeEngine::setPosition ( const QPointF position)
inline

Definition at line 187 of file qquicktextnodeengine_p.h.

References position().

+ Here is the call graph for this function:

◆ setSelectedTextColor()

void QQuickTextNodeEngine::setSelectedTextColor ( const QColor selectedTextColor)
inline

Definition at line 172 of file qquicktextnodeengine_p.h.

◆ setSelectionColor()

void QQuickTextNodeEngine::setSelectionColor ( const QColor selectionColor)
inline

Definition at line 167 of file qquicktextnodeengine_p.h.

◆ setTextColor()

void QQuickTextNodeEngine::setTextColor ( const QColor textColor)
inline

Definition at line 177 of file qquicktextnodeengine_p.h.

Referenced by addText(), and addTextBlock().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ QQuickTextNode

friend class QQuickTextNode
friend

Definition at line 237 of file qquicktextnodeengine_p.h.


The documentation for this class was generated from the following files: