6#include <QtCore/qpoint.h>
7#include <QtGui/qabstracttextdocumentlayout.h>
8#include <QtGui/qrawfont.h>
9#include <QtGui/qtextdocument.h>
10#include <QtGui/qtextlayout.h>
11#include <QtGui/qtextobject.h>
12#include <QtGui/qtexttable.h>
13#include <QtGui/qtextlist.h>
15#include <private/qquicktext_p.h>
16#include <private/qtextdocumentlayout_p.h>
17#include <private/qtextimagehandler_p.h>
18#include <private/qrawfont_p.h>
19#include <private/qglyphrun_p.h>
20#include <private/qquickitem_p.h>
28 , clipNode(node->clipNode)
30 , selectionState(node->selectionState)
37 const Decorations &decs,
43 , selectionState(selState)
60 Decorations decorations,
const QColor &textColor,
88 int newIndex = binaryTree->size();
89 binaryTree->append(binaryTreeNode);
115 QVarLengthArray<int> *sortedIndexes,
int currentIndex)
117 Q_ASSERT(currentIndex < binaryTree.size());
123 sortedIndexes->append(currentIndex);
133 const QVarLengthArray<QTextLayout::FormatRange> &colorChanges,
134 int textPos,
int fragmentEnd,
135 int selectionStart,
int selectionEnd)
142 while (textPos < fragmentEnd) {
143 int blockRelativePosition = textPos - block.
position();
153 int len =
qMin(lineEnd - textPos, fragmentEnd - textPos);
156 int currentStepEnd = textPos +
len;
164 textPos = currentStepEnd;
169void QQuickTextNodeEngine::addTextDecorations(
const QVarLengthArray<TextDecoration> &textDecorations,
172 for (
int i=0;
i<textDecorations.size(); ++
i) {
173 TextDecoration textDecoration = textDecorations.at(
i);
178 rect.setHeight(thickness);
181 m_lines.
append(textDecoration);
185void QQuickTextNodeEngine::processCurrentLine()
188 if (m_currentLineTree.isEmpty())
197 QVarLengthArray<int> sortedIndexes;
200 Q_ASSERT(sortedIndexes.size() == m_currentLineTree.size());
206 qreal underlineOffset = 0.0;
207 qreal underlineThickness = 0.0;
209 qreal overlineOffset = 0.0;
210 qreal overlineThickness = 0.0;
212 qreal strikeOutOffset = 0.0;
213 qreal strikeOutThickness = 0.0;
215 QRectF decorationRect = currentRect;
218 QColor lastBackgroundColor;
219 QColor lastDecorationColor;
221 QVarLengthArray<TextDecoration> pendingUnderlines;
222 QVarLengthArray<TextDecoration> pendingOverlines;
223 QVarLengthArray<TextDecoration> pendingStrikeOuts;
224 if (!sortedIndexes.isEmpty()) {
226 bool currentClipNodeUsed =
false;
227 for (
int i=0;
i<=sortedIndexes.size(); ++
i) {
228 BinaryTreeNode *node =
nullptr;
229 if (
i < sortedIndexes.size()) {
230 int sortedIndex = sortedIndexes.at(
i);
231 Q_ASSERT(sortedIndex < m_currentLineTree.size());
233 node = m_currentLineTree.data() + sortedIndex;
235 currentSelectionState = node->selectionState;
240 decorationRect.setY(m_position.
y() + m_currentLine.
y());
241 decorationRect.setHeight(m_currentLine.
height());
244 decorationRect.setRight(node->boundingRect.left());
246 TextDecoration textDecoration(currentSelectionState, decorationRect, lastColor);
247 if (lastDecorationColor.isValid() &&
251 textDecoration.color = lastDecorationColor;
254 pendingUnderlines.append(textDecoration);
257 pendingOverlines.append(textDecoration);
260 pendingStrikeOuts.append(textDecoration);
269 if (node ==
nullptr || node->selectionState != currentSelectionState) {
270 currentRect.setY(m_position.
y() + m_currentLine.
y());
271 currentRect.setHeight(m_currentLine.
height());
273 if (currentSelectionState ==
Selected)
274 m_selectionRects.
append(currentRect);
276 if (currentClipNode !=
nullptr) {
277 if (!currentClipNodeUsed) {
278 delete currentClipNode;
280 currentClipNode->setIsRectangular(
true);
281 currentClipNode->setRect(currentRect);
282 currentClipNode->update();
286 if (node !=
nullptr && m_hasSelection)
289 currentClipNode =
nullptr;
290 currentClipNodeUsed =
false;
292 if (node !=
nullptr) {
293 currentSelectionState = node->selectionState;
294 currentRect = node->boundingRect;
297 if (currentRect.isNull())
298 currentRect.setSize(
QSizeF(1, 1));
301 if (currentRect.isNull())
302 currentRect = node->boundingRect;
304 currentRect = currentRect.united(node->boundingRect);
307 if (node !=
nullptr) {
308 if (node->selectionState ==
Selected) {
309 node->clipNode = currentClipNode;
310 currentClipNodeUsed =
true;
313 decorationRect = node->boundingRect;
317 if (!pendingUnderlines.isEmpty()
319 addTextDecorations(pendingUnderlines, underlineOffset, underlineThickness);
321 pendingUnderlines.clear();
323 underlineOffset = 0.0;
324 underlineThickness = 0.0;
329 if (!pendingOverlines.isEmpty()) {
330 addTextDecorations(pendingOverlines, overlineOffset, overlineThickness);
332 pendingOverlines.clear();
334 overlineOffset = 0.0;
335 overlineThickness = 0.0;
340 if (!pendingStrikeOuts.isEmpty()) {
341 addTextDecorations(pendingStrikeOuts, strikeOutOffset, strikeOutThickness);
343 pendingStrikeOuts.clear();
345 strikeOutOffset = 0.0;
346 strikeOutThickness = 0.0;
350 QRawFont rawFont = node->glyphRun.rawFont();
359 overlineOffset = -rawFont.
ascent();
365 strikeOutOffset = rawFont.
ascent() / -3.0;
368 currentDecorations = node->decorations;
369 lastColor = node->color;
370 lastBackgroundColor = node->backgroundColor;
371 lastDecorationColor = node->decorationColor;
372 m_processedNodes.append(*node);
376 if (!pendingUnderlines.isEmpty())
377 addTextDecorations(pendingUnderlines, underlineOffset, underlineThickness);
379 if (!pendingOverlines.isEmpty())
380 addTextDecorations(pendingOverlines, overlineOffset, overlineThickness);
382 if (!pendingStrikeOuts.isEmpty())
383 addTextDecorations(pendingStrikeOuts, strikeOutOffset, strikeOutThickness);
386 m_currentLineTree.clear();
388 m_hasSelection =
false;
397 if (m_currentLineTree.isEmpty()) {
402 searchRect.moveTopLeft(m_position + m_currentLine.
position() +
QPointF(0,
y));
404 const BinaryTreeNode *lastNode = m_currentLineTree.data() + m_currentLineTree.size() - 1;
405 if (lastNode->glyphRun.isRightToLeft()) {
406 QPointF lastPos = lastNode->boundingRect.topLeft();
407 searchRect.moveTopRight(lastPos -
QPointF(0, ascent - lastNode->ascent));
409 QPointF lastPos = lastNode->boundingRect.topRight();
410 searchRect.moveTopLeft(lastPos -
QPointF(0, ascent - lastNode->ascent));
416 m_hasContents =
true;
425 if (handler !=
nullptr) {
432 image = imageHandler->
image(textDocument, imageFormat);
435 if (
image.isNull()) {
449 switch (
format.verticalAlignment())
452 ascent =
line.ascent();
456 ascent = (
line.ascent() +
line.descent()) / 2 -
line.descent() +
size.height() / 2;
459 ascent =
size.height() -
line.descent();
463 ascent =
size.height();
484 int currentSize = m_currentLineTree.size();
493 m_hasSelection = m_hasSelection || m_currentLineTree.size() > currentSize;
498 int selectionStart,
int selectionEnd)
500 int currentPosition =
start;
502 for (
int j=0;
j<ranges.size(); ++
j) {
504 if (
range.start +
range.length > currentPosition
505 &&
range.start < currentPosition + remainingLength) {
507 if (
range.start > currentPosition) {
511 int rangeEnd =
qMin(
range.start +
range.length, currentPosition + remainingLength);
514 rangeColor =
range.format.foreground().color();
515 else if (
range.format.isAnchor())
516 rangeColor = m_anchorColor;
518 ?
range.format.background().color()
522 ?
range.format.underlineColor()
526 rangeColor, rangeBackgroundColor, rangeDecorationColor,
527 selectionStart, selectionEnd);
530 remainingLength =
end - currentPosition;
532 }
else if (
range.start > currentPosition + remainingLength || remainingLength <= 0) {
537 if (remainingLength > 0) {
539 selectionStart, selectionEnd);
546 int selectionStart,
int selectionEnd)
549 if (
color.isValid()) {
550 oldColor = m_textColor;
554 QColor oldBackgroundColor = m_backgroundColor;
555 if (backgroundColor.
isValid()) {
556 oldBackgroundColor = m_backgroundColor;
557 m_backgroundColor = backgroundColor;
560 QColor oldDecorationColor = m_decorationColor;
561 if (decorationColor.
isValid()) {
562 oldDecorationColor = m_decorationColor;
563 m_decorationColor = decorationColor;
567 && selectionStart <= selectionEnd;
570 int rangeEnd = rangeStart + rangeLength;
571 if (!
hasSelection || (selectionStart > rangeEnd || selectionEnd < rangeStart)) {
572 QList<QGlyphRun> glyphRuns =
line.glyphRuns(rangeStart, rangeLength);
573 for (
int j=0;
j<glyphRuns.size(); ++
j) {
578 if (rangeStart < selectionStart) {
579 int length =
qMin(selectionStart - rangeStart, rangeLength);
580 QList<QGlyphRun> glyphRuns =
line.glyphRuns(rangeStart,
length);
581 for (
int j=0;
j<glyphRuns.size(); ++
j) {
587 if (rangeEnd > selectionStart) {
588 int start =
qMax(selectionStart, rangeStart);
592 for (
int j=0;
j<glyphRuns.size(); ++
j) {
598 if (selectionEnd >= rangeStart && selectionEnd < rangeEnd) {
599 int start = selectionEnd + 1;
600 int length = rangeEnd - selectionEnd - 1;
602 for (
int j=0;
j<glyphRuns.size(); ++
j) {
610 m_decorationColor = oldDecorationColor;
613 m_backgroundColor = oldBackgroundColor;
615 if (oldColor.isValid())
616 m_textColor = oldColor;
621 const QBrush &borderBrush)
636 QTextDocumentLayout *documentLayout = qobject_cast<QTextDocumentLayout *>(document->documentLayout());
663 const auto collapsed =
table->format().borderCollapse();
669 borderWidth, borderStyle, borderBrush);
671 if (
table !=
nullptr) {
672 int rows =
table->rows();
673 int columns =
table->columns();
680 addBorder(cellRect.
adjusted(-borderWidth, -borderWidth, collapsed ? -borderWidth : 0, collapsed ? -borderWidth : 0), borderWidth,
681 borderStyle, borderBrush);
693 QList<BinaryTreeNode *> *imageNodes)
695 QHash<BinaryTreeNodeKey, QList<BinaryTreeNode *> >
map;
697 for (
int i = 0;
i < m_processedNodes.size(); ++
i) {
706 QList<BinaryTreeNode *> &nodes =
map[
key];
708 regularNodes->append(node);
712 imageNodes->append(node);
716 for (
int i = 0;
i < regularNodes->size(); ++
i) {
720 const QList<BinaryTreeNode *> &nodes =
map.
value(
key);
721 Q_ASSERT(nodes.first() == primaryNode);
724 for (
int j = 0;
j < nodes.size(); ++
j)
725 count += nodes.at(
j)->glyphRun.glyphIndexes().size();
727 if (
count != primaryNode->glyphRun.glyphIndexes().size()) {
728 QGlyphRun &glyphRun = primaryNode->glyphRun;
729 QVector<quint32> glyphIndexes = glyphRun.
glyphIndexes();
730 glyphIndexes.reserve(
count);
732 QVector<QPointF> glyphPositions = glyphRun.
positions();
733 glyphPositions.reserve(
count);
737 for (
int j = 1;
j < nodes.size(); ++
j) {
739 glyphIndexes += otherNode->glyphRun.glyphIndexes();
740 primaryNode->ranges += otherNode->ranges;
741 glyphBoundingRect = glyphBoundingRect.united(otherNode->boundingRect);
743 QVector<QPointF> otherPositions = otherNode->glyphRun.positions();
744 for (
int k = 0; k < otherPositions.size(); ++k)
745 glyphPositions += otherPositions.at(k) + (otherNode->position - primaryNode->position);
763 processCurrentLine();
765 QList<BinaryTreeNode *> nodes;
766 QList<BinaryTreeNode *> imageNodes;
769 for (
int i = 0;
i < m_backgrounds.
size(); ++
i) {
772 if (
color.alpha() != 0)
777 for (
int i = 0;
i < nodes.size(); ++
i) {
782 for (
int i = 0;
i < imageNodes.size(); ++
i) {
789 for (
int i = 0;
i < m_selectionRects.
size(); ++
i) {
791 if (m_selectionColor.
alpha() != 0)
796 for (
int i = 0;
i < m_lines.
size(); ++
i) {
797 const TextDecoration &textDecoration = m_lines.
at(
i);
800 ? m_selectedTextColor
801 : textDecoration.color;
807 for (
int i = 0;
i < nodes.size(); ++
i) {
810 if (clipNode !=
nullptr && clipNode->
parent() ==
nullptr)
815 int previousNodeIndex =
i - 1;
816 int nextNodeIndex =
i + 1;
817 const BinaryTreeNode *previousNode = previousNodeIndex < 0 ? 0 : nodes.at(previousNodeIndex);
819 previousNode = --previousNodeIndex < 0 ? 0 : nodes.at(previousNodeIndex);
821 const BinaryTreeNode *nextNode = nextNodeIndex == nodes.size() ? 0 : nodes.at(nextNodeIndex);
831 bool drawCurrent =
false;
832 if (previousNode !=
nullptr || nextNode !=
nullptr) {
836 int rangeLength =
range.second -
range.first + 1;
837 if (previousNode !=
nullptr) {
839 const QPair<int, int> &otherRange = previousNode->
ranges.
at(
j);
841 if (
range.first < otherRange.second &&
range.second > otherRange.first) {
845 if (rangeLength == 0)
851 if (nextNode !=
nullptr && rangeLength > 0) {
853 const QPair<int, int> &otherRange = nextNode->
ranges.
at(
j);
855 if (
range.first < otherRange.second &&
range.second > otherRange.first) {
859 if (rangeLength == 0)
865 if (rangeLength > 0) {
879 for (
int i = 0;
i < imageNodes.size(); ++
i) {
892void QQuickTextNodeEngine::mergeFormats(
QTextLayout *textLayout, QVarLengthArray<QTextLayout::FormatRange> *mergedFormats)
895 if (textLayout ==
nullptr)
898 QVector<QTextLayout::FormatRange> additionalFormats = textLayout->
formats();
899 for (
int i=0;
i<additionalFormats.size(); ++
i) {
903 || additionalFormat.format.isAnchor()) {
905 if (!mergedFormats->isEmpty()) {
908 if (additionalFormat.start < lastFormat->start + lastFormat->length) {
912 if (additionalFormat.start > lastFormat->start) {
913 lastFormat->length = additionalFormat.start - lastFormat->start;
914 length -= lastFormat->length;
917 mergedRange = mergedFormats->data() + mergedFormats->size() - 1;
918 lastFormat = mergedFormats->data() + mergedFormats->size() - 2;
920 mergedRange = lastFormat;
923 mergedRange->format = lastFormat->format;
924 mergedRange->format.merge(additionalFormat.format);
925 mergedRange->start = additionalFormat.start;
927 int end =
qMin(additionalFormat.start + additionalFormat.length,
928 lastFormat->start + lastFormat->length);
930 mergedRange->length =
end - mergedRange->start;
931 length -= mergedRange->length;
933 additionalFormat.start =
end;
934 additionalFormat.length =
length;
938 if (additionalFormat.length > 0)
939 mergedFormats->append(additionalFormat);
965 QVarLengthArray<QTextLayout::FormatRange> colorChanges;
966 mergeFormats(block.
layout(), &colorChanges);
973 qCDebug(lcSgText) <<
"adding block with length" << block.
length() <<
':' << blockBoundingRect <<
"in viewport" <<
viewport;
982 if (
layout->lineCount() > 0) {
998 switch (listFormat.
style()) {
1000 listItemBullet =
QChar(0x25E6);
1003 listItemBullet =
QChar(0x25AA);
1010 listItemBullet = textList->itemText(block);
1013 listItemBullet =
QChar(0x2022);
1019 listItemBullet =
QChar(0x2612);
1022 listItemBullet =
QChar(0x2610);
1031 xoff = -xoff -
size.width();
1036 layout.setText(listItemBullet);
1048 QList<QGlyphRun> glyphRuns =
layout.glyphRuns();
1049 for (
int i=0;
i<glyphRuns.size(); ++
i)
1057 while (!blockIterator.atEnd()) {
1079 int blockRelativePosition = textPos - block.
position();
1087 (selectionStart < textPos +
text.
size()
1088 && selectionEnd >= textPos)
1103 int fragmentEnd = textPos + fragment.
length();
1105 if (preeditPosition >= 0
1106 && (preeditPosition + block.
position()) >= textPos
1107 && (preeditPosition + block.
position()) <= fragmentEnd) {
1108 fragmentEnd += preeditLength;
1114 additionalFormat.length = fragmentEnd - textPos;
1115 additionalFormat.format = charFormat;
1116 colorChanges << additionalFormat;
1119 textPos =
addText(block, charFormat, textColor, colorChanges, textPos, fragmentEnd,
1120 selectionStart, selectionEnd);
1127 if (preeditLength >= 0 && textPos <= block.
position() + preeditPosition) {
1129 textPos = block.
position() + preeditPosition;
1136 textPos, textPos + preeditLength,
1137 selectionStart, selectionEnd);
1144 QRectF ruleRect(0, 0, ruleLength.value(blockBoundingRect.
width()), 1);
1145 ruleRect.moveCenter(blockBoundingRect.
center());
1153 m_hasContents =
true;
virtual QRectF blockBoundingRect(const QTextBlock &block) const =0
Returns the bounding rectangle of block.
QTextObjectInterface * handlerForObject(int objectType) const
Returns a handler for objects of the given objectType.
const QColor & color() const
Returns the brush color.
Qt::BrushStyle style() const
Returns the brush style.
The QColor class provides colors based on RGB, HSV or CMYK values.
int alpha() const noexcept
Returns the alpha color component of this color.
void setAlpha(int alpha)
Sets the alpha of this color to alpha.
bool isValid() const noexcept
Returns true if the color is valid; otherwise returns false.
\reentrant \inmodule QtGui
static QGlyphRunPrivate * get(const QGlyphRun &glyphRun)
The QGlyphRun class provides direct access to the internal glyphs in a font.
bool overline() const
Returns true if this QGlyphRun should be painted with an overline decoration.
bool strikeOut() const
Returns true if this QGlyphRun should be painted with a strike out decoration.
void setPositions(const QList< QPointF > &positions)
Sets the positions of the edge of the baseline for each glyph in this set of glyph indexes to positio...
QList< quint32 > glyphIndexes() const
Returns the glyph indexes for this QGlyphRun object.
void setBoundingRect(const QRectF &boundingRect)
Sets the bounding rect of the glyphs in this QGlyphRun to be boundingRect.
QRawFont rawFont() const
Returns the font selected for this QGlyphRun object.
void setGlyphIndexes(const QList< quint32 > &glyphIndexes)
Set the glyph indexes for this QGlyphRun object to glyphIndexes.
bool isEmpty() const
Returns true if the QGlyphRun does not contain any glyphs.
QRectF boundingRect() const
Returns the smallest rectangle that contains all glyphs in this QGlyphRun.
QList< QPointF > positions() const
Returns the position of the edge of the baseline for each glyph in this set of glyph indexes.
bool underline() const
Returns true if this QGlyphRun should be painted with an underline decoration.
bool isNull() const
Returns true if it is a null image, otherwise returns false.
@ Format_ARGB32_Premultiplied
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
void append(parameter_type t)
T value(const Key &key, const T &defaultValue=T()) const
The QPainter class performs low-level painting on widgets and other paint devices.
\inmodule QtCore\reentrant
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
void addSelectedGlyphs(const QGlyphRun &glyphRun)
void addUnselectedGlyphs(const QGlyphRun &glyphRun)
void addTextObject(const QTextBlock &block, const QPointF &position, const QTextCharFormat &format, SelectionState selectionState, QTextDocument *textDocument, int pos, QTextFrameFormat::Position layoutPosition=QTextFrameFormat::InFlow)
void mergeProcessedNodes(QList< BinaryTreeNode * > *regularNodes, QList< BinaryTreeNode * > *imageNodes)
void addTextBlock(QTextDocument *, const QTextBlock &, const QPointF &position, const QColor &textColor, const QColor &anchorColor, int selectionStart, int selectionEnd, const QRectF &viewport=QRectF())
void addGlyphsInRange(int rangeStart, int rangeEnd, const QColor &color, const QColor &backgroundColor, const QColor &underlineColor, int selectionStart, int selectionEnd)
void setTextColor(const QColor &textColor)
QTextLine currentLine() const
void setCurrentLine(const QTextLine ¤tLine)
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 addImage(const QRectF &rect, const QImage &image, qreal ascent, SelectionState selectionState, QTextFrameFormat::Position layoutPosition)
void addBorder(const QRectF &rect, qreal border, QTextFrameFormat::BorderStyle borderStyle, const QBrush &borderBrush)
void addFrameDecorations(QTextDocument *document, QTextFrame *frame)
void setCurrentTextDirection(Qt::LayoutDirection textDirection)
void addGlyphsForRanges(const QVarLengthArray< QTextLayout::FormatRange > &ranges, int start, int end, int selectionStart, int selectionEnd)
void addToSceneGraph(QSGInternalTextNode *parent, QQuickText::TextStyle style=QQuickText::Normal, const QColor &styleColor=QColor())
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.
qreal underlinePosition() const
Returns the position from baseline for drawing underlines below the text rendered with this font.
qreal lineThickness() const
Returns the thickness for drawing lines (underline, overline, etc.) along with text drawn in this fon...
\inmodule QtCore\reentrant
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr void setY(qreal pos) noexcept
Sets the top edge of the rectangle to the given finite y coordinate.
constexpr QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
bool intersects(const QRectF &r) const noexcept
Returns true if this rectangle intersects with the given rectangle (i.e.
constexpr QPointF topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr QPointF center() const noexcept
Returns the center point of the rectangle.
constexpr void translate(qreal dx, qreal dy) noexcept
Moves the rectangle dx along the x-axis and dy along the y-axis, relative to the current position.
constexpr QPointF topRight() const noexcept
Returns the position of the rectangle's top-right corner.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr int width() const noexcept
Returns the width of the rectangle.
void addImage(const QRectF &rect, const QImage &image)
virtual void addDecorationNode(const QRectF &rect, const QColor &color)
QSGGlyphNode * addGlyphs(const QPointF &position, const QGlyphRun &glyphs, const QColor &color, QQuickText::TextStyle style=QQuickText::Normal, const QColor &styleColor=QColor(), QSGNode *parentNode=0)
void addRectangleNode(const QRectF &rect, const QColor &color)
void appendChildNode(QSGNode *node)
Appends node to this node's list of children.
QSGNode * parent() const
Returns the parent node of this node.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
qsizetype size() const noexcept
Returns the number of characters in this string.
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
MarkerType marker() const
iterator begin() const
Returns a text block iterator pointing to the beginning of the text block.
int length() const
Returns the length of the block in characters.
QTextBlockFormat blockFormat() const
Returns the QTextBlockFormat that describes block-specific properties.
bool isValid() const
Returns true if this text block is valid; otherwise returns false.
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.
Qt::LayoutDirection textDirection() const
QTextCharFormat charFormat() const
Returns the QTextCharFormat that describes the block's character format.
QTextList * textList() const
If the block represents a list item, returns the list that the item belongs to; otherwise returns \nu...
bool isAnchor() const
Returns true if the text is formatted as an anchor; otherwise returns false.
VerticalAlignment verticalAlignment() const
Returns the vertical alignment used for characters with this format.
QFont font() const
Returns the font for this character format.
QRectF tableCellBoundingRect(QTextTable *table, const QTextTableCell &cell) const
virtual QRectF frameBoundingRect(QTextFrame *frame) const override
Returns the bounding rectangle of frame.
QRectF tableBoundingRect(QTextTable *table) const
\reentrant \inmodule QtGui
QAbstractTextDocumentLayout * documentLayout() const
Returns the document layout for this document.
QTextObject * objectForFormat(const QTextFormat &) const
Returns the text object associated with the format f.
QBrush background() const
Returns the brush used to paint the document's background.
@ BlockTrailingHorizontalRulerWidth
QTextImageFormat toImageFormat() const
Returns this format as an image format.
bool hasProperty(int propertyId) const
Returns true if the text format has a property with the given propertyId; otherwise returns false.
int objectType() const
Returns the text format's object type.
QVariant property(int propertyId) const
Returns the property specified by the given propertyId.
QBrush foreground() const
Returns the brush used to render foreground details, such as text, frame outlines,...
QString text() const
Returns the text fragment's as plain text.
QTextCharFormat charFormat() const
Returns the text fragment's character format.
int length() const
Returns the number of characters in the text fragment.
QBrush borderBrush() const
qreal border() const
Returns the width of the border in pixels.
BorderStyle borderStyle() const
qreal bottomMargin() const
Position
This enum describes how a frame is located relative to the surrounding text.
qreal rightMargin() const
QImage image(QTextDocument *doc, const QTextImageFormat &imageFormat)
QTextLine lineForTextPosition(int pos) const
Returns the line that contains the cursor position specified by pos.
QList< FormatRange > formats() const
int preeditAreaPosition() const
Returns the position of the area in the text layout that will be processed before editing occurs.
QString preeditAreaText() const
Returns the text that is inserted in the layout before editing occurs.
QRectF rect() const
Returns the line's bounding rectangle.
qreal height() const
Returns the line's height.
qreal y() const
Returns the line's y position.
bool isValid() const
Returns true if this text line is valid; otherwise returns false.
qreal ascent() const
Returns the line's ascent.
QPointF position() const
Returns the line's position relative to the text layout's position.
Style style() const
Returns the list format's style.
The QTextObjectInterface class allows drawing of custom text objects in \l{QTextDocument}s.
virtual void drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format)=0
Draws this text object using the specified painter.
virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format)=0
The intrinsicSize() function returns the size of the text object represented by format in the given d...
QMap< QString, QString > map
[6]
cache insert(employee->id(), employee)
Combined button and popup list for selecting options.
static QDBusError::ErrorType get(const char *name)
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
constexpr QtPrivate::QHashMultiReturnType< T... > qHashMulti(size_t seed, const T &... args) noexcept(std::conjunction_v< QtPrivate::QNothrowHashable< T >... >)
static bool hasSelection()
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
n void setPosition(void) \n\
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint border
GLenum GLuint GLintptr offset
GLint GLsizei GLsizei GLenum format
GLenum GLenum GLsizei void GLsizei void * column
GLenum GLenum GLsizei void * row
GLenum GLenum GLsizei void * table
static const QRectF boundingRect(const QPointF *points, int pointCount)
QT_BEGIN_NAMESPACE constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) noexcept(noexcept(std::make_pair(std::forward< T1 >(value1), std::forward< T2 >(value2))))
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
view viewport() -> scroll(dx, dy, deviceRect)
\inmodule QtCore \reentrant
SelectionState selectionState
QList< QPair< int, int > > ranges
static void insert(QVarLengthArray< BinaryTreeNode, 16 > *binaryTree, const QRectF &rect, const QImage &image, qreal ascent, SelectionState selectionState)
QQuickDefaultClipNode * clipNode
static void inOrder(const QVarLengthArray< BinaryTreeNode, 16 > &binaryTree, QVarLengthArray< int > *sortedIndexes, int currentIndex=0)