7#include <private/qqmldebugserviceinterfaces_p.h>
8#include <private/qqmldebugconnector_p.h>
10#include <QtQuick/private/qsgcontext_p.h>
11#include <private/qqmlglobal_p.h>
12#include <private/qsgadaptationlayer_p.h>
18#include <QtQuick/private/qsgtexture_p.h>
20#include <QtQml/qqmlinfo.h>
21#include <QtGui/qevent.h>
22#include <QtGui/qabstracttextdocumentlayout.h>
23#include <QtGui/qpainter.h>
24#include <QtGui/qtextdocument.h>
25#include <QtGui/qtextobject.h>
26#include <QtGui/qtextcursor.h>
27#include <QtGui/qguiapplication.h>
28#include <QtGui/qinputmethod.h>
30#include <private/qtextengine_p.h>
31#include <private/qquickstyledtext_p.h>
32#include <QtQuick/private/qquickpixmapcache_p.h>
43#if !defined(QQUICKTEXT_LARGETEXT_THRESHOLD)
44 #define QQUICKTEXT_LARGETEXT_THRESHOLD 10000
51 ,
color(0xFF000000), linkColor(0xFF0000FF), styleColor(0xFF000000)
52 , lineCount(1), multilengthEos(-1)
57 , updateType(UpdatePaintNode)
58 , maximumLineCountValid(
false), updateOnComponentComplete(true), richText(
false)
60 , requireImplicitSize(
false), implicitWidthValid(
false), implicitHeightValid(
false)
61 , truncated(
false), hAlignImplicit(true), rightToLeftText(
false)
62 , layoutTextElided(
false), textHasChanged(true), needToUpdateLayout(
false), formatModifiesFontSize(
false)
64 , updateSizeRecursionGuard(
false)
75 , explicitTopPadding(
false)
76 , explicitLeftPadding(
false)
77 , explicitRightPadding(
false)
78 , explicitBottomPadding(
false)
81 , minimumPixelSize(12)
82 , minimumPointSize(12)
83 , nbActiveDownloads(0)
84 , maximumLineCount(INT_MAX)
85 , renderTypeQuality(
QQuickText::DefaultRenderTypeQuality)
86 , lineHeightValid(
false)
87 , lineHeightMode(
QQuickText::ProportionalHeight)
105 if (
extra.isAllocated()) {
107 extra->imgTags.clear();
136 return q->width() -
q->leftPadding() -
q->rightPadding();
142 return q->height() -
q->topPadding() -
q->bottomPadding();
148 qreal oldPadding =
q->topPadding();
155 emit q->topPaddingChanged();
162 qreal oldPadding =
q->leftPadding();
169 emit q->leftPaddingChanged();
176 qreal oldPadding =
q->rightPadding();
183 emit q->rightPaddingChanged();
190 qreal oldPadding =
q->bottomPadding();
197 emit q->bottomPaddingChanged();
210void QQuickText::q_updateLayout()
219 if (!
q->isComponentComplete()) {
226 if (
extra.isAllocated())
227 extra->visibleImgTags.clear();
236 bool fontSizeModified =
false;
239 if (someImgTags.
size() ||
extra.isAllocated())
240 extra.value().imgTags = someImgTags;
253 }
else if (
extra.isAllocated() &&
extra->lineHeightValid) {
261 cursor.mergeBlockFormat(blockFormat);
276void QQuickText::imageDownloadFinished()
280 (
d->extra->nbActiveDownloads)--;
286 if (
d->extra.isAllocated() &&
d->extra->nbActiveDownloads == 0) {
289 if (!
img->size.isValid()) {
290 img->size =
img->pix->implicitSize();
296 d->textHasChanged =
true;
311 if (
q->heightValid()) {
318 q->setBaselineOffset(
baseline + yoff +
q->topPadding());
324 const QSizeF contentSize(
q->contentWidth(),
q->contentHeight());
326 if (contentSize != previousSize) {
327 emit q->contentSizeChanged();
328 if (contentSize.
width() != previousSize.
width())
329 emit q->contentWidthChanged(contentSize.
width());
331 emit q->contentHeightChanged(contentSize.
height());
339 if (!
q->isComponentComplete()) {
352 qreal hPadding =
q->leftPadding() +
q->rightPadding();
353 qreal vPadding =
q->topPadding() +
q->bottomPadding();
355 const QSizeF previousSize(
q->contentWidth(),
q->contentHeight());
375 emit q->lineCountChanged();
407 option.setAlignment((Qt::Alignment)
int(horizontalAlignment |
vAlign));
411 qreal naturalWidth = 0;
413 extra->doc->setTextWidth(-1);
414 naturalWidth =
extra->doc->idealWidth();
417 q->setImplicitWidth(naturalWidth + hPadding);
427 extra->doc->setTextWidth(
extra->doc->idealWidth());
438 qreal oldWidth =
q->width();
440 if (!
q->widthValid())
441 iWidth =
size.width();
461 firstBlock = firstBlock.
next();
500 m_fullLayoutTextLength =
length;
531 return m_line->
width();
623 if (formatLength > 0) {
625 format.length = formatLength;
687 emit q->truncatedChanged();
692 emit q->lineCountChanged();
707 if (
extra.isAllocated())
708 extra->visibleImgTags.clear();
711 if (textOption.
alignment() !=
q->effectiveHAlign()
714 textOption.
setAlignment(Qt::Alignment(
q->effectiveHAlign()));
739 const qreal minimumSize = pixelSize
744 ? qMin<qreal>(minimumSize, largeFont)
746 qreal scaledFontSize = largeFont;
747 const qreal sizeFittingThreshold(0.01);
757 int visibleCount = 0;
783 bool wrapped =
false;
784 bool truncateHeight =
false;
787 int unwrappedLineCount = 1;
790 qreal naturalHeight = 0;
791 qreal previousHeight = 0;
796 for (visibleCount = 1; ; ++visibleCount) {
799 if (noBreakLastLine && visibleCount == maxLineCount)
806 if (noBreakLastLine && visibleCount == maxLineCount)
809 unelidedRect = br.
united(
line.naturalTextRect());
813 if (multilineElide && naturalHeight > maxHeight && visibleCount > 1) {
820 truncateHeight =
true;
835 const bool isLastLine =
line.textStart() +
line.textLength() >= layoutText.
size();
837 if (singlelineElide && visibleCount == 1 &&
line.naturalTextWidth() >
line.width()) {
851 elideStart =
line.textStart();
852 elideEnd = elideStart +
line.textLength();
860 wrapped |= wrappedLine;
863 ++unwrappedLineCount;
866 if (visibleCount == maxLineCount) {
870 if (multilineElide) {
876 elideText = wrappedLine
879 elideStart =
line.textStart();
908 ++unwrappedLineCount;
914 const int eol =
line.isValid()
915 ?
line.textStart() +
line.textLength()
919 for (;
line.isValid() && unwrappedLineCount <= maxLineCount; ++unwrappedLineCount)
928 q->setImplicitSize(naturalWidth +
q->leftPadding() +
q->rightPadding(), naturalHeight +
qMax(
lineHeightOffset(), 0) +
q->topPadding() +
q->bottomPadding());
943 const qreal oldHeight = maxHeight;
948 lineWidth =
q->widthValid() &&
q->width() > 0 ? availWidth : naturalWidth;
949 maxHeight =
q->heightValid() ? availHeight : FLT_MAX;
954 && (singlelineElide || multilineElide || canWrap || horizontalFit
964 if ((maxHeight <
qMin(oldHeight, naturalHeight) || (
heightExceeded && maxHeight > oldHeight))
980 if (
line.isValid()) {
1001 const qreal oldHeight = maxHeight;
1005 if ((maxHeight <
qMin(oldHeight, naturalHeight) || (
heightExceeded && maxHeight > oldHeight))
1017 if (eos != -1 && elide) {
1018 int start = eos + 1;
1034 lastLine.
y() - firstLine.
y());
1039 if (!horizontalFit && !verticalFit)
1047 if (horizontalFit) {
1048 if (unelidedRect.
width() >
lineWidth || (!verticalFit && wrapped)) {
1050 largeFont = scaledFontSize;
1052 scaledFontSize = (smallFont + largeFont) / 2;
1055 }
else if (!verticalFit) {
1056 smallFont = scaledFontSize;
1059 if ((largeFont - smallFont) < sizeFittingThreshold)
1062 scaledFontSize = (smallFont + largeFont) / 2;
1067 if (truncateHeight || unelidedRect.
height() > maxHeight) {
1069 largeFont = scaledFontSize;
1071 scaledFontSize = (smallFont + largeFont) / 2;
1074 smallFont = scaledFontSize;
1077 if ((largeFont - smallFont) < sizeFittingThreshold)
1080 scaledFontSize = (smallFont + largeFont) / 2;
1096 emit q->fontInfoChanged();
1124 elideEnd - elideText.
size() +
index + 1,
1153 if (visibleCount == 1)
1172 emit q->lineCountChanged();
1176 emit q->truncatedChanged();
1186 if (
extra.isAllocated() &&
extra->imgTags.isEmpty()) {
1194 qreal totalLineHeight = textHeight;
1198 if (
extra.isAllocated()) {
1200 if (
image->position >=
line.textStart() &&
1207 if (
image->pix->isLoading()) {
1208 image->pix->connectFinished(
q,
SLOT(imageDownloadFinished()));
1209 if (!
extra.isAllocated() || !
extra->nbActiveDownloads)
1210 extra.value().nbActiveDownloads = 0;
1211 extra->nbActiveDownloads++;
1212 }
else if (
image->pix->isReady()) {
1213 if (!
image->size.isValid()) {
1219 }
else if (
image->pix->isError()) {
1228 image->pos.setY((textHeight / 2.0) - (ih / 2.0));
1230 image->pos.setY(textHeight - ih);
1231 imagesInLine <<
image;
1238 totalLineHeight =
qMax(totalLineHeight, textTop +
image->pos.y() +
image->size.height());
1239 const int leadX =
line.cursorToX(
image->position);
1241 const bool rtl = trailX < leadX;
1271 extra->doc->setDocumentMargin(0);
1282#if QT_CONFIG(textmarkdownreader)
1287#if QT_CONFIG(texthtmlparser)
1292 extra->doc->clearResources();
1692 return d->sourceFont;
1698 if (
d->sourceFont ==
font)
1701 d->sourceFont =
font;
1708 if (
d->font.pointSizeF() != -1) {
1711 d->font.setPointSizeF(
size/2.0);
1714 if (oldFont !=
d->font) {
1717 if (
d->formatModifiesFontSize)
1718 d->textHasChanged =
true;
1719 d->implicitWidthValid =
false;
1720 d->implicitHeightValid =
false;
1737 d->implicitWidthValid =
false;
1738 d->implicitHeightValid =
false;
1748 d->implicitWidthValid =
false;
1749 d->implicitHeightValid =
false;
1784 d->richText =
d->format ==
RichText ||
d->markdownText;
1789 d->updateDocumentText();
1792 d->rightToLeftText =
d->text.isRightToLeft();
1794 d->determineHorizontalAlignment();
1796 d->textHasChanged =
true;
1797 d->implicitWidthValid =
false;
1798 d->implicitHeightValid =
false;
1800 if (
d->extra.isAllocated()) {
1802 d->extra->imgTags.clear();
1841 if (
d->color ==
rgb)
1872 if (
d->linkColor ==
rgb)
1951 if (
d->styleColor ==
rgb)
1954 d->styleColor =
rgb;
1995 bool forceAlign =
d->hAlignImplicit &&
d->effectiveLayoutMirror;
1996 d->hAlignImplicit =
false;
2004 d->hAlignImplicit =
true;
2013 if (!
d->hAlignImplicit &&
d->effectiveLayoutMirror) {
2014 switch (
d->hAlign) {
2025 return effectiveAlignment;
2036 if (oldEffectiveHAlign !=
q->effectiveHAlign())
2037 emit q->effectiveHorizontalAlignmentChanged();
2059 if (
q->isComponentComplete()) {
2062 emit q->effectiveHorizontalAlignmentChanged();
2076 if (
d->vAlign == align)
2114 if (
mode ==
d->wrapMode)
2135 return d->lineCount;
2151 return d->truncated;
2168 return d->maximumLineCount();
2175 d->maximumLineCountValid = lines==INT_MAX ?
false :
true;
2176 if (
d->maximumLineCount() != lines) {
2177 d->extra.value().maximumLineCount = lines;
2178 d->implicitHeightValid =
false;
2188 if (
d->truncated !=
false) {
2189 d->truncated =
false;
2269 bool wasRich =
d->richText;
2275 if (!wasRich &&
d->richText) {
2276 d->updateDocumentText();
2279 d->rightToLeftText =
d->text.isRightToLeft();
2280 d->textHasChanged =
true;
2282 d->determineHorizontalAlignment();
2320 return d->elideMode;
2326 if (
mode ==
d->elideMode)
2329 d->elideMode =
mode;
2361 if (!
d->extra.isAllocated() ||
d->extra->baseUrl.isEmpty()) {
2367 return d->extra->baseUrl;
2375 d->extra.value().baseUrl =
url;
2379 d->extra->doc->setBaseUrl(
url);
2381 if (
d->styledText) {
2382 d->textHasChanged =
true;
2383 if (
d->extra.isAllocated()) {
2385 d->extra->imgTags.clear();
2417 rect.adjust(-1, 0, 1, 2);
2440 rect.adjust(-1, 0, 1, 2);
2448 if (
d->text.isEmpty()) {
2460 bool widthMaximum = newGeometry.
width() >= oldGeometry.
width() && !
d->widthExceeded;
2461 bool heightMaximum = newGeometry.
height() >= oldGeometry.
height() && !
d->heightExceeded;
2466 goto geomChangeDone;
2475 if (!wrapped && !
elide && !scaleFont && !verticalPositionChanged)
2476 goto geomChangeDone;
2481 goto geomChangeDone;
2484 if (widthMaximum && heightMaximum && !
d->isLineLaidOutConnected() && !verticalPositionChanged)
2485 goto geomChangeDone;
2487 if (!(
widthChanged || widthMaximum) && !
d->isLineLaidOutConnected()) {
2488 if (!verticalPositionChanged) {
2492 goto geomChangeDone;
2494 if (
d->lineCount ==
d->maximumLineCount())
2495 goto geomChangeDone;
2496 }
else if (newGeometry.
height() < oldGeometry.
height()) {
2497 if (
d->lineCount < 2 && !verticalScale && newGeometry.
height() > 0)
2498 goto geomChangeDone;
2502 && !(
d->maximumLineCountValid &&
d->widthExceeded)) {
2503 goto geomChangeDone;
2510 goto geomChangeDone;
2514 if (
d->updateOnComponentComplete ||
d->textHasChanged) {
2526void QQuickText::triggerPreprocess()
2539 if (
d->text.isEmpty()) {
2573 }
else if (
d->layedOutTextRect.width() > 0) {
2575 int unelidedLineCount =
d->lineCount;
2577 unelidedLineCount -= 1;
2578 if (unelidedLineCount > 0) {
2584 0, unelidedLineCount);
2589 if (
d->extra.isAllocated()) {
2592 if (
pix &&
pix->isReady())
2608 const bool clipNodeChanged =
2609 d->componentComplete &&
d->clipNode() &&
d->clipNode()->rect() !=
clipRect();
2610 if (clipNodeChanged)
2617 d->polishSize =
true;
2619 if (
d->polishSize) {
2621 d->polishSize =
false;
2635 return d->layedOutTextRect.width();
2647 return d->layedOutTextRect.height() +
qMax(
d->lineHeightOffset(), 0);
2662 return d->lineHeight();
2672 d->extra.value().lineHeightValid =
true;
2674 d->implicitHeightValid =
false;
2692 return d->lineHeightMode();
2698 if (
mode ==
d->lineHeightMode())
2701 d->implicitHeightValid =
false;
2702 d->extra.value().lineHeightValid =
true;
2703 d->extra.value().lineHeightMode =
mode;
2747 return d->fontSizeMode();
2753 if (
d->fontSizeMode() ==
mode)
2756 d->polishSize =
true;
2759 d->extra.value().fontSizeMode =
mode;
2776 return d->minimumPixelSize();
2782 if (
d->minimumPixelSize() ==
size)
2786 d->polishSize =
true;
2789 d->extra.value().minimumPixelSize =
size;
2806 return d->minimumPointSize();
2812 if (
d->minimumPointSize() ==
size)
2816 d->polishSize =
true;
2819 d->extra.value().minimumPointSize =
size;
2829 if (
d->richText &&
d->extra.isAllocated() &&
d->extra->doc)
2830 return d->extra->doc->resourcesLoading();
2838 if (
d->updateOnComponentComplete) {
2840 d->updateDocumentText();
2842 d->rightToLeftText =
d->text.isRightToLeft();
2844 d->determineHorizontalAlignment();
2847 if (
d->updateOnComponentComplete)
2859 if (formatRange.format.isAnchor()
2860 && charPos >= formatRange.start
2861 && charPos < formatRange.start + formatRange.length) {
2862 return formatRange.format.anchorHref();
2874 QPointF translatedMousePos = mousePos;
2875 translatedMousePos.
rx() -=
q->leftPadding();
2884 return extra->doc->documentLayout()->anchorAt(translatedMousePos);
2901 if (
d->isLinkActivatedConnected())
2902 link =
d->anchorAt(
event->position());
2905 event->setAccepted(
false);
2907 d->extra.value().activeLink = link;
2912 if (!
event->isAccepted())
2925 if (
d->isLinkActivatedConnected())
2926 link =
d->anchorAt(
event->position());
2928 if (!link.
isEmpty() &&
d->extra.isAllocated() &&
d->extra->activeLink == link)
2931 event->setAccepted(
false);
2933 if (!
event->isAccepted())
2946 if (formatRange.format.isAnchor()) {
2947 const int start = formatRange.start;
2948 const int len = formatRange.length;
2953 r.setHeight(
line.height());
2959 const QString anchorHref = formatRange.format.anchorHref();
2961 anchorName = anchorHref;
3001 if (
d->extra.isAllocated())
3002 return d->extra->hoveredLink;
3004#if QT_CONFIG(cursor)
3007 return d->anchorAt(
pos);
3024 extra.value().hoveredLink = link;
3034 d->processHoverEvent(
event);
3040 d->processHoverEvent(
event);
3046 d->processHoverEvent(
event);
3052 d->textHasChanged =
true;
3092 return d->renderTypeQuality();
3107 emit renderTypeQualityChanged();
3130 return d->renderType;
3146#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
3147#if QT_DEPRECATED_SINCE(5, 15)
3154void QQuickText::doLayout()
3167void QQuickText::forceLayout()
3198 if (
d->richText &&
d->extra.isAllocated() &&
d->extra->doc !=
nullptr) {
3200 for (block =
d->extra->doc->firstBlock(); block.
isValid(); block = block.
next()) {
3205 if (
d->layout.engine() !=
nullptr)
3206 d->layout.engine()->resetFontEngineCache();
3224 return d->padding();
3233 d->extra.value().padding =
padding;
3235 emit paddingChanged();
3236 if (!
d->extra.isAllocated() || !
d->extra->explicitTopPadding)
3237 emit topPaddingChanged();
3238 if (!
d->extra.isAllocated() || !
d->extra->explicitLeftPadding)
3239 emit leftPaddingChanged();
3240 if (!
d->extra.isAllocated() || !
d->extra->explicitRightPadding)
3241 emit rightPaddingChanged();
3242 if (!
d->extra.isAllocated() || !
d->extra->explicitBottomPadding)
3243 emit bottomPaddingChanged();
3254 if (
d->extra.isAllocated() &&
d->extra->explicitTopPadding)
3255 return d->extra->topPadding;
3256 return d->padding();
3268 d->setTopPadding(0,
true);
3274 if (
d->extra.isAllocated() &&
d->extra->explicitLeftPadding)
3275 return d->extra->leftPadding;
3276 return d->padding();
3288 d->setLeftPadding(0,
true);
3294 if (
d->extra.isAllocated() &&
d->extra->explicitRightPadding)
3295 return d->extra->rightPadding;
3296 return d->padding();
3308 d->setRightPadding(0,
true);
3314 if (
d->extra.isAllocated() &&
d->extra->explicitBottomPadding)
3315 return d->extra->bottomPadding;
3316 return d->padding();
3328 d->setBottomPadding(0,
true);
3392 qmlWarning(
this) <<
"fontInfo: item has no JS engine";
3427#include "moc_qquicktext_p.cpp"
The QColor class provides colors based on RGB, HSV or CMYK values.
static QColor fromRgba(QRgb rgba) noexcept
Static convenience function that returns a QColor constructed from the given QRgb value rgba.
static QPoint pos()
Returns the position of the cursor (hot spot) of the primary screen in global screen coordinates.
qreal pointSizeF() const
Returns the point size of the matched window system font.
int pixelSize() const
Returns the pixel size of the matched window system font.
QString family() const
Returns the family name of the matched window system font.
bool italic() const
Returns the italic value of the matched window system font.
QString styleName() const
int weight() const
Returns the weight of the matched window system font.
\reentrant \inmodule QtGui
qreal height() const
Returns the height of the font.
qreal ascent() const
Returns the ascent of the font.
int pixelSize() const
Returns the pixel size of the font if it was set with setPixelSize().
void setPixelSize(int)
Sets the font size to pixelSize pixels, with a maxiumum size of an unsigned 16-bit integer.
qreal pointSizeF() const
Returns the point size of the font.
void setPointSizeF(qreal)
Sets the point size to pointSize.
static QInputMethod * inputMethod()
returns the input method.
The QJSEngine class provides an environment for evaluating JavaScript code.
QJSValue newObject()
Creates a JavaScript object of class Object.
The QJSValue class acts as a container for Qt/JavaScript data types.
void setProperty(const QString &name, const QJSValue &value)
Sets the value of this QJSValue's property with the given name to the given value.
qsizetype size() const noexcept
void append(parameter_type t)
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
int height() const
Returns the height of the pixmap.
int width() const
Returns the width of the pixmap.
\inmodule QtCore\reentrant
constexpr qreal & ry() noexcept
Returns a reference to the y coordinate of this point.
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
constexpr qreal & rx() noexcept
Returns a reference to the x coordinate of this point.
The QQmlContext class defines a context within a QML engine.
virtual bool transformChanged(QQuickItem *transformedItem)
virtual void implicitHeightChanged()
quint32 implicitAntialiasing
virtual void implicitWidthChanged()
QQuickAnchorLine baseline() const
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
QPointF mapToScene(const QPointF &point) const
Maps the given point in this item's coordinate system to the equivalent point within the scene's coor...
virtual void mouseReleaseEvent(QMouseEvent *event)
This event handler can be reimplemented in a subclass to receive mouse release events for an item.
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
virtual void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
void setAcceptHoverEvents(bool enabled)
If enabled is true, this sets the item to accept hover events; otherwise, hover events are not accept...
void setAcceptedMouseButtons(Qt::MouseButtons buttons)
Sets the mouse buttons accepted by this item to buttons.
QQuickWindow * window() const
Returns the window in which this item is rendered.
virtual void mousePressEvent(QMouseEvent *event)
This event handler can be reimplemented in a subclass to receive mouse press events for an item.
virtual void itemChange(ItemChange, const ItemChangeData &)
Called when change occurs for this item.
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
bool heightValid() const
Returns whether the height property has been set explicitly.
bool antialiasing
\qmlproperty bool QtQuick::Item::antialiasing
bool widthValid() const
Returns whether the width property has been set explicitly.
virtual QRectF clipRect() const
Returns the rectangular area within this item that is currently visible in \l viewportItem(),...
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
@ ItemAntialiasingHasChanged
@ ItemDevicePixelRatioHasChanged
void update()
Schedules a call to updatePaintNode() for this item.
void polish()
Schedules a polish event for this item.
static void parse(const QString &string, QTextLayout &layout, QList< QQuickStyledTextImgTag * > &imgTags, const QUrl &baseUrl, QQmlContext *context, bool preloadImages, bool *fontSizeModified)
void setWidth(qreal width)
void setFullLayoutTextLength(int length)
void setLine(QTextLine *line)
void setLineOffset(int offset)
void setHeight(qreal height)
void addImage(const QRectF &rect, const QImage &image)
void setUseNativeRenderer(bool on)
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 setRenderTypeQuality(int renderTypeQuality)
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)
QQuickText::LineHeightMode lineHeightMode() const
qreal getImplicitHeight() const override
QVector< LinkDesc > getLinks() const
int minimumPixelSize() const
QLazilyAllocated< ExtraData > extra
bool updateOnComponentComplete
qreal availableHeight() const
void setRightPadding(qreal value, bool reset=false)
void elideFormats(int start, int length, int offset, QVector< QTextLayout::FormatRange > *elidedFormats)
bool isLinkActivatedConnected()
bool transformChanged(QQuickItem *transformedItem) override
int minimumPointSize() const
void processHoverEvent(QHoverEvent *event)
int maximumLineCount() const
void ensureDoc()
Ensures the QQuickTextPrivate::doc variable is set to a valid text document.
QQuickText::RenderType renderType
bool updateSizeRecursionGuard
qreal getImplicitWidth() const override
QQuickText::TextElideMode elideMode
QQuickText::WrapMode wrapMode
bool maximumLineCountValid
void setBottomPadding(qreal value, bool reset=false)
bool setHAlign(QQuickText::HAlignment, bool forceAlign=false)
qreal availableWidth() const
int lineHeightOffset() const
Returns the y offset when aligning text with a non-1.0 lineHeight.
QQuickTextLine * textLine
void updateDocumentText()
void setTopPadding(qreal value, bool reset=false)
void mirrorChange() override
bool determineHorizontalAlignment()
QQuickText::VAlignment vAlign
bool formatModifiesFontSize
static const int largeTextSizeThreshold
bool isLineLaidOutConnected()
static const QChar elideChar
QString elidedText(qreal lineWidth, const QTextLine &line, const QTextLine *nextLine=nullptr) const
void setLeftPadding(qreal value, bool reset=false)
bool isLinkHoveredConnected()
QQuickText::FontSizeMode fontSizeMode() const
void updateBaseline(qreal baseline, qreal dy)
void signalSizeChange(const QSizeF &previousSize)
void setLineGeometry(QTextLine &line, qreal lineWidth, qreal &height)
void setupCustomLineGeometry(QTextLine &line, qreal &height, int fullLayoutTextLength, int lineOffset=0)
QStringList links() const
QTextLayout * elideLayout
QQuickText::HAlignment hAlign
static QString anchorAt(const QTextLayout *layout, const QPointF &mousePos)
QRectF setupTextLayout(qreal *const baseline)
Lays out the QQuickTextPrivate::layout QTextLayout in the constraints of the QQuickText.
static qreal alignedX(qreal textWidth, qreal itemWidth, int alignment)
static qreal alignedY(qreal textHeight, qreal itemHeight, int alignment)
QQuickText(QQuickItem *parent=nullptr)
\qmltype Text \instantiates QQuickText \inqmlmodule QtQuick\inherits Item
void verticalAlignmentChanged(QQuickText::VAlignment alignment)
void minimumPointSizeChanged()
void setBaseUrl(const QUrl &url)
void setRenderType(RenderType renderType)
void invalidate() override
void updatePolish() override
This function should perform any layout as required for this item.
QRectF boundingRect() const override
Returns the extents of the text after layout.
void setPadding(qreal padding)
int resourcesLoading() const
Returns the number of resources (images) that are being loaded asynchronously.
void minimumPixelSizeChanged()
void setText(const QString &)
void setStyle(TextStyle style)
void setFont(const QFont &font)
HAlignment effectiveHAlign() const
void textChanged(const QString &text)
void elideModeChanged(QQuickText::TextElideMode mode)
void setLeftPadding(qreal padding)
QRectF clipRect() const override
Returns a rectangular area slightly larger than what is currently visible in \l viewportItem(); other...
void setMinimumPixelSize(int size)
FontSizeMode fontSizeMode
void setMaximumLineCount(int lines)
void lineHeightModeChanged(LineHeightMode mode)
void mouseReleaseEvent(QMouseEvent *event) override
HAlignment hAlign() const
\qmlproperty enumeration QtQuick::Text::horizontalAlignment \qmlproperty enumeration QtQuick::Text::v...
void fontSizeModeChanged()
void fontChanged(const QFont &font)
void setElideMode(TextElideMode)
VAlignment vAlign() const
void setLineHeightMode(LineHeightMode)
void setLinkColor(const QColor &color)
void componentComplete() override
void setLineHeight(qreal lineHeight)
void setVAlign(VAlignment align)
void hoverLeaveEvent(QHoverEvent *event) override
This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
void setHAlign(HAlignment align)
void mousePressEvent(QMouseEvent *event) override
void setFontSizeMode(FontSizeMode mode)
void styleChanged(QQuickText::TextStyle style)
void setTopPadding(qreal padding)
void textFormatChanged(QQuickText::TextFormat textFormat)
void setTextFormat(TextFormat format)
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
TextElideMode elideMode() const
\qmlproperty enumeration QtQuick::Text::elide
void linkActivated(const QString &link)
FINALint renderTypeQuality
QSGNode * updatePaintNode(QSGNode *, UpdatePaintNodeData *) override
Called on the render thread when it is time to sync the state of the item with the scene graph.
void maximumLineCountChanged()
void setColor(const QColor &c)
void lineHeightChanged(qreal lineHeight)
void hoverMoveEvent(QHoverEvent *event) override
This event handler can be reimplemented in a subclass to receive hover-move events for an item.
void setRightPadding(qreal padding)
LineHeightMode lineHeightMode
void setWrapMode(WrapMode w)
void invalidateFontCaches()
void setBottomPadding(qreal padding)
void setMinimumPointSize(int size)
void setRenderTypeQuality(int renderTypeQuality)
void itemChange(ItemChange change, const ItemChangeData &value) override
Called when change occurs for this item.
void setStyleColor(const QColor &c)
void resetMaximumLineCount()
void hoverEnterEvent(QHoverEvent *event) override
This event handler can be reimplemented in a subclass to receive hover-enter events for an item.
void resetBottomPadding()
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
\inmodule QtCore\reentrant
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr void setHeight(qreal h) noexcept
Sets the height of the rectangle to the given finite height.
constexpr void moveTop(qreal pos) noexcept
Moves the rectangle vertically, leaving the rectangle's top line at the given finite y coordinate.
QRectF united(const QRectF &other) const noexcept
\inmodule QtCore\reentrant
constexpr QSize size() const noexcept
Returns the size of the rectangle.
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
constexpr qreal width() const noexcept
Returns the width.
constexpr qreal height() const noexcept
Returns the height.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString & replace(qsizetype i, qsizetype len, QChar after)
qsizetype size() const
Returns the number of characters in this string.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
void setLineHeight(qreal height, int heightType)
bool isValid() const
Returns true if this text block is valid; otherwise returns false.
QTextBlock next() const
Returns the text block in the document after this block, or an empty text block if this is the last o...
QTextLayout * layout() const
Returns the QTextLayout that is used to lay out and display the block's contents.
QTextBlock previous() const
Returns the text block in the document before this block, or an empty text block if this is the first...
\reentrant \inmodule QtGui
void resetFontEngineCache()
QString elidedText(Qt::TextElideMode mode, QFixed width, int flags=0, int from=0, int count=-1) const
const QTextOption & textOption() const
Returns the current text option used to control the layout process.
void setFont(const QFont &f)
Sets the layout's font to the given font.
QTextLine createLine()
Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise ret...
void beginLayout()
Begins the layout process.
QTextEngine * engine() const
void setCacheEnabled(bool enable)
Enables caching of the complete layout information if enable is true; otherwise disables layout cachi...
void setFormats(const QList< FormatRange > &overrides)
void setText(const QString &string)
Sets the layout's text to the given string.
QList< FormatRange > formats() const
QString text() const
Returns the layout's text.
int lineCount() const
Returns the number of lines in this text layout.
qreal maximumWidth() const
The maximum width the layout could expand to; this is essentially the width of the entire text.
QTextLine lineAt(int i) const
Returns the {i}-th line of text in this text layout.
void setTextOption(const QTextOption &option)
Sets the text option structure that controls the layout process to the given option.
QFont font() const
Returns the current font that is used for the layout, or a default font if none is set.
void endLayout()
Ends the layout process.
int textStart() const
Returns the start of the line from the beginning of the string passed to the QTextLayout.
QRectF naturalTextRect() const
Returns the rectangle covered by the line.
qreal height() const
Returns the line's height.
qreal naturalTextWidth() const
Returns the width of the line that is occupied by text.
qreal y() const
Returns the line's y position.
qreal width() const
Returns the line's width as specified by the layout() function.
void setPosition(const QPointF &pos)
Moves the line to position pos.
bool isValid() const
Returns true if this text line is valid; otherwise returns false.
void setLineWidth(qreal width)
Lays out the line with the given width.
qreal ascent() const
Returns the line's ascent.
int lineNumber() const
Returns the position of the line in the text engine.
qreal horizontalAdvance() const
qreal x() const
Returns the line's x position.
int textLength() const
Returns the length of the text in the line.
WrapMode wrapMode() const
Returns the text wrap mode defined by the option.
Qt::Alignment alignment() const
Returns the text alignment defined by the option.
void setWrapMode(WrapMode wrap)
Sets the option's text wrap mode to the given mode.
void setUseDesignMetrics(bool b)
If enable is true then the layout will use design metrics; otherwise it will use the metrics of the p...
void setAlignment(Qt::Alignment alignment)
Sets the option's text alignment to the specified alignment.
bool useDesignMetrics() const
Returns true if the layout uses design rather than device metrics; otherwise returns false.
WrapMode
This enum describes how text is wrapped in a document.
qDeleteAll(list.begin(), list.end())
QSet< QString >::iterator it
Combined button and popup list for selecting options.
Q_GUI_EXPORT bool mightBeRichText(const QString &)
Returns true if the string text is likely to be rich text; otherwise returns false.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
Q_QML_EXPORT QJSEngine * qjsEngine(const QObject *)
#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)
constexpr T qAbs(const T &t)
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLsizei GLenum const void GLuint GLsizei GLfloat * metrics
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLint GLsizei GLsizei GLenum format
GLdouble GLdouble GLdouble GLdouble q
QQmlContext * qmlContext(const QObject *obj)
#define qmlobject_connect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Connect Signal of Sender to Method of Receiver.
#define IS_SIGNAL_CONNECTED(Sender, SenderType, Name, Arguments)
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
#define QQUICKTEXT_LARGETEXT_THRESHOLD
static void getLinks_helper(const QTextLayout *layout, QVector< QQuickTextPrivate::LinkDesc > *links)
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
#define QStringLiteral(str)
QUrl url("example.com")
[constructor-url-reference]
static constexpr QFixed fromReal(qreal r)
\inmodule QtCore \reentrant
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent