Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQuickText Class Reference

#include <qquicktext_p.h>

+ Inheritance diagram for QQuickText:
+ Collaboration diagram for QQuickText:

Public Types

enum  HAlignment { AlignLeft = Qt::AlignLeft , AlignRight = Qt::AlignRight , AlignHCenter = Qt::AlignHCenter , AlignJustify = Qt::AlignJustify }
 
enum  VAlignment { AlignTop = Qt::AlignTop , AlignBottom = Qt::AlignBottom , AlignVCenter = Qt::AlignVCenter }
 
enum  TextStyle { Normal , Outline , Raised , Sunken }
 
enum  TextFormat {
  PlainText = Qt::PlainText , RichText = Qt::RichText , MarkdownText = Qt::MarkdownText , AutoText = Qt::AutoText ,
  StyledText = 4
}
 
enum  TextElideMode { ElideLeft = Qt::ElideLeft , ElideRight = Qt::ElideRight , ElideMiddle = Qt::ElideMiddle , ElideNone = Qt::ElideNone }
 
enum  WrapMode {
  NoWrap = QTextOption::NoWrap , WordWrap = QTextOption::WordWrap , WrapAnywhere = QTextOption::WrapAnywhere , WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere ,
  Wrap = QTextOption::WrapAtWordBoundaryOrAnywhere
}
 
enum  RenderType { QtRendering , NativeRendering , CurveRendering }
 
enum  RenderTypeQuality {
  DefaultRenderTypeQuality = -1 , LowRenderTypeQuality = 26 , NormalRenderTypeQuality = 52 , HighRenderTypeQuality = 104 ,
  VeryHighRenderTypeQuality = 208
}
 
enum  LineHeightMode { ProportionalHeight , FixedHeight }
 
enum  FontSizeMode { FixedSize = 0x0 , HorizontalFit = 0x01 , VerticalFit = 0x02 , Fit = HorizontalFit | VerticalFit }
 
- Public Types inherited from QQuickItem
enum  Flag {
  ItemClipsChildrenToShape = 0x01 , ItemIsFocusScope = 0x04 , ItemHasContents = 0x08 , ItemAcceptsDrops = 0x10 ,
  ItemIsViewport = 0x20 , ItemObservesViewport = 0x40
}
 \qmltype Item \instantiates QQuickItem \inherits QtObject \inqmlmodule QtQuick More...
 
enum  ItemChange {
  ItemChildAddedChange , ItemChildRemovedChange , ItemSceneChange , ItemVisibleHasChanged ,
  ItemParentHasChanged , ItemOpacityHasChanged , ItemActiveFocusHasChanged , ItemRotationHasChanged ,
  ItemAntialiasingHasChanged , ItemDevicePixelRatioHasChanged , ItemEnabledHasChanged
}
 Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes. More...
 
enum  TransformOrigin {
  TopLeft , Top , TopRight , Left ,
  Center , Right , BottomLeft , Bottom ,
  BottomRight
}
 \variable QQuickItem::ItemChangeData::realValue The numeric value that has changed: \l {QQuickItem::opacity()}{opacity}, \l {QQuickItem::rotation()}{rotation}, or \l {QScreen::devicePixelRatio}{device pixel ratio}. More...
 

Signals

void textChanged (const QString &text)
 
void linkActivated (const QString &link)
 
 Q_REVISION (2, 2) void linkHovered(const QString &link)
 
void fontChanged (const QFont &font)
 
void colorChanged ()
 
void linkColorChanged ()
 
void styleChanged (QQuickText::TextStyle style)
 
void styleColorChanged ()
 
void horizontalAlignmentChanged (QQuickText::HAlignment alignment)
 
void verticalAlignmentChanged (QQuickText::VAlignment alignment)
 
void wrapModeChanged ()
 
void lineCountChanged ()
 
void truncatedChanged ()
 
void maximumLineCountChanged ()
 
void textFormatChanged (QQuickText::TextFormat textFormat)
 
void elideModeChanged (QQuickText::TextElideMode mode)
 
void contentSizeChanged ()
 
void contentWidthChanged (qreal contentWidth)
 
void contentHeightChanged (qreal contentHeight)
 
void lineHeightChanged (qreal lineHeight)
 
void lineHeightModeChanged (LineHeightMode mode)
 
void fontSizeModeChanged ()
 
void minimumPixelSizeChanged ()
 
void minimumPointSizeChanged ()
 
void effectiveHorizontalAlignmentChanged ()
 
void lineLaidOut (QQuickTextLine *line)
 
void baseUrlChanged ()
 
void renderTypeChanged ()
 
 Q_REVISION (2, 6) void paddingChanged()
 
 Q_REVISION (2, 6) void topPaddingChanged()
 
 Q_REVISION (2, 6) void leftPaddingChanged()
 
 Q_REVISION (2, 6) void rightPaddingChanged()
 
 Q_REVISION (2, 6) void bottomPaddingChanged()
 
 Q_REVISION (2, 9) void fontInfoChanged()
 
 Q_REVISION (6, 0) void renderTypeQualityChanged()
 
- Signals inherited from QQuickItem
void childrenRectChanged (const QRectF &)
 
void baselineOffsetChanged (qreal)
 
void stateChanged (const QString &)
 
void focusChanged (bool)
 
void activeFocusChanged (bool)
 
Q_REVISION(6, 7) void focusPolicyChanged(Qt Q_REVISION (2, 1) void activeFocusOnTabChanged(bool)
 
void parentChanged (QQuickItem *)
 
void transformOriginChanged (TransformOrigin)
 
void smoothChanged (bool)
 
void antialiasingChanged (bool)
 
void clipChanged (bool)
 
 Q_REVISION (2, 1) void windowChanged(QQuickWindow *window)
 
void childrenChanged ()
 
void opacityChanged ()
 
void enabledChanged ()
 
void visibleChanged ()
 
void visibleChildrenChanged ()
 
void rotationChanged ()
 
void scaleChanged ()
 
void xChanged ()
 
void yChanged ()
 
void widthChanged ()
 
void heightChanged ()
 
void zChanged ()
 
void implicitWidthChanged ()
 
void implicitHeightChanged ()
 
 Q_REVISION (2, 11) void containmentMaskChanged()
 
 Q_REVISION (6, 0) void paletteChanged()
 
 Q_REVISION (6, 0) void paletteCreated()
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 

Public Member Functions

 QQuickText (QQuickItem *parent=nullptr)
 \qmltype Text \instantiates QQuickText \inqmlmodule QtQuick\inherits Item
 
 ~QQuickText () override
 
QString text () const
 \qmlproperty string QtQuick::Text::text
 
void setText (const QString &)
 
QFont font () const
 \qmlproperty bool QtQuick::Text::clip This property holds whether the text is clipped.
 
void setFont (const QFont &font)
 
QColor color () const
 \qmlproperty color QtQuick::Text::color
 
void setColor (const QColor &c)
 
QColor linkColor () const
 \qmlproperty color QtQuick::Text::linkColor
 
void setLinkColor (const QColor &color)
 
TextStyle style () const
 \qmlproperty enumeration QtQuick::Text::style
 
void setStyle (TextStyle style)
 
QColor styleColor () const
 \qmlproperty color QtQuick::Text::styleColor
 
void setStyleColor (const QColor &c)
 
HAlignment hAlign () const
 \qmlproperty enumeration QtQuick::Text::horizontalAlignment \qmlproperty enumeration QtQuick::Text::verticalAlignment \qmlproperty enumeration QtQuick::Text::effectiveHorizontalAlignment
 
void setHAlign (HAlignment align)
 
void resetHAlign ()
 
HAlignment effectiveHAlign () const
 
VAlignment vAlign () const
 
void setVAlign (VAlignment align)
 
WrapMode wrapMode () const
 \qmlproperty enumeration QtQuick::Text::wrapMode
 
void setWrapMode (WrapMode w)
 
int lineCount () const
 \qmlproperty int QtQuick::Text::lineCount
 
bool truncated () const
 \qmlproperty bool QtQuick::Text::truncated
 
int maximumLineCount () const
 \qmlproperty int QtQuick::Text::maximumLineCount
 
void setMaximumLineCount (int lines)
 
void resetMaximumLineCount ()
 
TextFormat textFormat () const
 \qmlproperty enumeration QtQuick::Text::textFormat
 
void setTextFormat (TextFormat format)
 
TextElideMode elideMode () const
 \qmlproperty enumeration QtQuick::Text::elide
 
void setElideMode (TextElideMode)
 
qreal lineHeight () const
 \qmlproperty real QtQuick::Text::lineHeight
 
void setLineHeight (qreal lineHeight)
 
LineHeightMode lineHeightMode () const
 \qmlproperty enumeration QtQuick::Text::lineHeightMode
 
void setLineHeightMode (LineHeightMode)
 
QUrl baseUrl () const
 \qmlproperty url QtQuick::Text::baseUrl
 
void setBaseUrl (const QUrl &url)
 
void resetBaseUrl ()
 
int minimumPixelSize () const
 \qmlproperty int QtQuick::Text::minimumPixelSize
 
void setMinimumPixelSize (int size)
 
int minimumPointSize () const
 \qmlproperty int QtQuick::Text::minimumPointSize
 
void setMinimumPointSize (int size)
 
FontSizeMode fontSizeMode () const
 \qmlproperty enumeration QtQuick::Text::fontSizeMode
 
void setFontSizeMode (FontSizeMode mode)
 
void componentComplete () override
 
int resourcesLoading () const
 Returns the number of resources (images) that are being loaded asynchronously.
 
qreal contentWidth () const
 \qmlproperty real QtQuick::Text::contentWidth
 
qreal contentHeight () const
 \qmlproperty real QtQuick::Text::contentHeight
 
QRectF boundingRect () const override
 Returns the extents of the text after layout.
 
QRectF clipRect () const override
 Returns a rectangular area slightly larger than what is currently visible in \l viewportItem(); otherwise, the rectangle (0, 0, width, height).
 
 Q_REVISION (2, 9) Q_INVOKABLE void forceLayout()
 
RenderType renderType () const
 \qmlproperty enumeration QtQuick::Text::renderType
 
void setRenderType (RenderType renderType)
 
int renderTypeQuality () const
 \qmlproperty int QtQuick::Text::renderTypeQuality
 
void setRenderTypeQuality (int renderTypeQuality)
 
QString hoveredLink () const
 \qmlsignal QtQuick::Text::linkHovered(string link)
 
 Q_REVISION (2, 3) Q_INVOKABLE QString linkAt(qreal x
 
qreal padding () const
 
void setPadding (qreal padding)
 
void resetPadding ()
 
qreal topPadding () const
 
void setTopPadding (qreal padding)
 
void resetTopPadding ()
 
qreal leftPadding () const
 
void setLeftPadding (qreal padding)
 
void resetLeftPadding ()
 
qreal rightPadding () const
 
void setRightPadding (qreal padding)
 
void resetRightPadding ()
 
qreal bottomPadding () const
 
void setBottomPadding (qreal padding)
 
void resetBottomPadding ()
 
QJSValue fontInfo () const
 \qmlproperty string QtQuick::Text::fontInfo.family
 
QSizeF advance () const
 \qmlproperty size QtQuick::Text::advance
 
void invalidate () override
 
- Public Member Functions inherited from QQuickItem
 QQuickItem (QQuickItem *parent=nullptr)
 Constructs a QQuickItem with the given parent.
 
 ~QQuickItem () override
 Destroys the QQuickItem.
 
QQuickWindowwindow () const
 Returns the window in which this item is rendered.
 
QQuickItemparentItem () const
 
void setParentItem (QQuickItem *parent)
 
void stackBefore (const QQuickItem *)
 Moves the specified sibling item to the index before this item within the list of children.
 
void stackAfter (const QQuickItem *)
 Moves the specified sibling item to the index after this item within the list of children.
 
QRectF childrenRect ()
 \qmlpropertygroup QtQuick::Item::childrenRect \qmlproperty real QtQuick::Item::childrenRect.x \qmlproperty real QtQuick::Item::childrenRect.y \qmlproperty real QtQuick::Item::childrenRect.width \qmlproperty real QtQuick::Item::childrenRect.height \readonly
 
QList< QQuickItem * > childItems () const
 Returns the children of this item.
 
bool clip () const
 \qmlproperty bool QtQuick::Item::clip This property holds whether clipping is enabled.
 
void setClip (bool)
 
QString state () const
 \qmlproperty string QtQuick::Item::state
 
void setState (const QString &)
 
qreal baselineOffset () const
 \qmlproperty int QtQuick::Item::baselineOffset
 
void setBaselineOffset (qreal)
 
QQmlListProperty< QQuickTransformtransform ()
 
qreal x () const
 
qreal y () const
 
QPointF position () const
 
void setX (qreal)
 
void setY (qreal)
 
void setPosition (const QPointF &)
 
QBindable< qrealbindableX ()
 
QBindable< qrealbindableY ()
 
qreal width () const
 
void setWidth (qreal)
 
void resetWidth ()
 
void setImplicitWidth (qreal)
 
qreal implicitWidth () const
 Returns the width of the item that is implied by other properties that determine the content.
 
QBindable< qrealbindableWidth ()
 
qreal height () const
 
void setHeight (qreal)
 
void resetHeight ()
 
void setImplicitHeight (qreal)
 
qreal implicitHeight () const
 
QBindable< qrealbindableHeight ()
 
QSizeF size () const
 
void setSize (const QSizeF &size)
 
TransformOrigin transformOrigin () const
 
void setTransformOrigin (TransformOrigin)
 
QPointF transformOriginPoint () const
 
void setTransformOriginPoint (const QPointF &)
 
qreal z () const
 
void setZ (qreal)
 
qreal rotation () const
 
void setRotation (qreal)
 
qreal scale () const
 
void setScale (qreal)
 
qreal opacity () const
 
void setOpacity (qreal)
 
bool isVisible () const
 
void setVisible (bool)
 
bool isEnabled () const
 
void setEnabled (bool)
 
bool smooth () const
 
void setSmooth (bool)
 
bool activeFocusOnTab () const
 \qmlproperty bool QtQuick::Item::activeFocusOnTab
 
void setActiveFocusOnTab (bool)
 
bool antialiasing () const
 
void setAntialiasing (bool)
 
void resetAntialiasing ()
 
Flags flags () const
 Returns the item flags for this 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 disabled.
 
void setFlags (Flags flags)
 Enables the specified flags for this item.
 
QQuickItemviewportItem () const
 If the \l ItemObservesViewport flag is set, returns the nearest parent with the \l ItemIsViewport flag.
 
bool hasActiveFocus () const
 
bool hasFocus () const
 
void setFocus (bool)
 
void setFocus (bool focus, Qt::FocusReason reason)
 
bool isFocusScope () const
 Returns true if this item is a focus scope, and false otherwise.
 
QQuickItemscopedFocusItem () const
 If this item is a focus scope, this returns the item in its focus chain that currently has focus.
 
Qt::FocusPolicy focusPolicy () const
 
void setFocusPolicy (Qt::FocusPolicy policy)
 Sets the focus policy of this item to policy.
 
bool isAncestorOf (const QQuickItem *child) const
 Returns true if this item is an ancestor of child (i.e., if this item is child's parent, or one of child's parent's ancestors).
 
Qt::MouseButtons acceptedMouseButtons () const
 Returns the mouse buttons accepted by this item.
 
void setAcceptedMouseButtons (Qt::MouseButtons buttons)
 Sets the mouse buttons accepted by this item to buttons.
 
bool acceptHoverEvents () const
 Returns whether hover events are accepted by this item.
 
void setAcceptHoverEvents (bool enabled)
 If enabled is true, this sets the item to accept hover events; otherwise, hover events are not accepted by this item.
 
bool acceptTouchEvents () const
 Returns whether touch events are accepted by this item.
 
void setAcceptTouchEvents (bool accept)
 If enabled is true, this sets the item to accept touch events; otherwise, touch events are not accepted by this item.
 
bool isUnderMouse () const
 
void grabMouse ()
 
void ungrabMouse ()
 
bool keepMouseGrab () const
 Returns whether mouse input should exclusively remain with this item.
 
void setKeepMouseGrab (bool)
 Sets whether the mouse input should remain exclusively with this item.
 
bool filtersChildMouseEvents () const
 Returns whether pointer events intended for this item's children should be filtered through this item.
 
void setFiltersChildMouseEvents (bool filter)
 Sets whether pointer events intended for this item's children should be filtered through this item.
 
void grabTouchPoints (const QList< int > &ids)
 
void ungrabTouchPoints ()
 
bool keepTouchGrab () const
 Returns whether the touch points grabbed by this item should exclusively remain with this item.
 
void setKeepTouchGrab (bool)
 Sets whether the touch points grabbed by this item should remain exclusively with this item.
 
 Q_REVISION (2, 4) Q_INVOKABLE bool grabToImage(const QJSValue &callback
 
QSharedPointer< QQuickItemGrabResultgrabToImage (const QSize &targetSize=QSize())
 Grabs the item into an in-memory image.
 
virtual Q_INVOKABLE bool contains (const QPointF &point) const
 \qmlmethod bool QtQuick::Item::contains(point point)
 
QObjectcontainmentMask () const
 
void setContainmentMask (QObject *mask)
 
QTransform itemTransform (QQuickItem *, bool *) const
 \qmlmethod point QtQuick::Item::mapFromItem(Item item, real x, real y) \qmlmethod point QtQuick::Item::mapFromItem(Item item, point p) \qmlmethod rect QtQuick::Item::mapFromItem(Item item, real x, real y, real width, real height) \qmlmethod rect QtQuick::Item::mapFromItem(Item item, rect r)
 
QPointF mapToScene (const QPointF &point) const
 Maps the given point in this item's coordinate system to the equivalent point within the scene's coordinate system, and returns the mapped coordinate.
 
QRectF mapRectToItem (const QQuickItem *item, const QRectF &rect) const
 Maps the given rect in this item's coordinate system to the equivalent rectangular area within item's coordinate system, and returns the mapped rectangle value.
 
QRectF mapRectToScene (const QRectF &rect) const
 Maps the given rect in this item's coordinate system to the equivalent rectangular area within the scene's coordinate system, and returns the mapped rectangle value.
 
QPointF mapFromScene (const QPointF &point) const
 Maps the given point in the scene's coordinate system to the equivalent point within this item's coordinate system, and returns the mapped coordinate.
 
QRectF mapRectFromItem (const QQuickItem *item, const QRectF &rect) const
 Maps the given rect in item's coordinate system to the equivalent rectangular area within this item's coordinate system, and returns the mapped rectangle value.
 
QRectF mapRectFromScene (const QRectF &rect) const
 Maps the given rect in the scene's coordinate system to the equivalent rectangular area within this item's coordinate system, and returns the mapped rectangle value.
 
void polish ()
 Schedules a polish event for this item.
 
Q_INVOKABLE QPointF mapFromItem (const QQuickItem *item, const QPointF &point) const
 Maps the given point in item's coordinate system to the equivalent point within this item's coordinate system, and returns the mapped coordinate.
 
Q_INVOKABLE QPointF mapFromItem (const QQuickItem *item, qreal x, qreal y)
 
Q_INVOKABLE QRectF mapFromItem (const QQuickItem *item, const QRectF &rect) const
 
Q_INVOKABLE QRectF mapFromItem (const QQuickItem *item, qreal x, qreal y, qreal width, qreal height) const
 
Q_INVOKABLE QPointF mapToItem (const QQuickItem *item, const QPointF &point) const
 Maps the given point in this item's coordinate system to the equivalent point within item's coordinate system, and returns the mapped coordinate.
 
Q_INVOKABLE QPointF mapToItem (const QQuickItem *item, qreal x, qreal y)
 
Q_INVOKABLE QRectF mapToItem (const QQuickItem *item, const QRectF &rect) const
 
Q_INVOKABLE QRectF mapToItem (const QQuickItem *item, qreal x, qreal y, qreal width, qreal height) const
 
 Q_REVISION (2, 7) Q_INVOKABLE QPointF mapFromGlobal(qreal x
 
 Q_REVISION (2, 7) Q_INVOKABLE QPointF mapFromGlobal(const QPointF &point) const
 
 Q_REVISION (2, 7) Q_INVOKABLE QPointF mapToGlobal(qreal x
 
 Q_REVISION (2, 7) Q_INVOKABLE QPointF mapToGlobal(const QPointF &point) const
 
Q_INVOKABLE void forceActiveFocus ()
 \qmlmethod point QtQuick::Item::mapToItem(Item item, real x, real y) \qmlmethod point QtQuick::Item::mapToItem(Item item, point p) \qmlmethod rect QtQuick::Item::mapToItem(Item item, real x, real y, real width, real height) \qmlmethod rect QtQuick::Item::mapToItem(Item item, rect r)
 
Q_INVOKABLE void forceActiveFocus (Qt::FocusReason reason)
 \qmlmethod QtQuick::Item::forceActiveFocus(Qt::FocusReason reason) This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Forces active focus on the item with the given reason.
 
 Q_REVISION (2, 1) Q_INVOKABLE QQuickItem *nextItemInFocusChain(bool forward
 
Q_INVOKABLE QQuickItemchildAt (qreal x, qreal y) const
 \qmlmethod QtQuick::Item::childAt(real x, real y)
 
 Q_REVISION (6, 3) Q_INVOKABLE void ensurePolished()
 
 Q_REVISION (6, 3) Q_INVOKABLE void dumpItemTree() const
 
virtual bool isTextureProvider () const
 Returns true if this item is a texture provider.
 
virtual QSGTextureProvidertextureProvider () const
 Returns the texture provider for an item.
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
 
- Public Member Functions inherited from QQmlParserStatus
 QQmlParserStatus ()
 
virtual ~QQmlParserStatus ()
 

Public Attributes

qreal y const
 
- Public Attributes inherited from QQuickItem
const QSizetargetSize = QSize())
 
qreal y const
 

Protected Member Functions

 QQuickText (QQuickTextPrivate &dd, QQuickItem *parent=nullptr)
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void itemChange (ItemChange change, const ItemChangeData &value) override
 Called when change occurs for this item.
 
void geometryChange (const QRectF &newGeometry, const QRectF &oldGeometry) override
 
QSGNodeupdatePaintNode (QSGNode *, UpdatePaintNodeData *) override
 Called on the render thread when it is time to sync the state of the item with the scene graph.
 
void updatePolish () override
 This function should perform any layout as required for this item.
 
void hoverEnterEvent (QHoverEvent *event) override
 This event handler can be reimplemented in a subclass to receive hover-enter events for an item.
 
void hoverMoveEvent (QHoverEvent *event) override
 This event handler can be reimplemented in a subclass to receive hover-move events for an item.
 
void hoverLeaveEvent (QHoverEvent *event) override
 This event handler can be reimplemented in a subclass to receive hover-leave events for an item.
 
void invalidateFontCaches ()
 
- Protected Member Functions inherited from QQuickImplicitSizeItem
 QQuickImplicitSizeItem (QQuickImplicitSizeItemPrivate &dd, QQuickItem *parent)
 
- Protected Member Functions inherited from QQuickItem
bool event (QEvent *) override
 \reimp
 
bool isComponentComplete () const
 Returns true if construction of the QML component is complete; otherwise returns false.
 
bool widthValid () const
 Returns whether the width property has been set explicitly.
 
bool heightValid () const
 Returns whether the height property has been set explicitly.
 
void setImplicitSize (qreal, qreal)
 
void classBegin () override
 \reimp Derived classes should call the base class method before adding their own action to perform at classBegin.
 
virtual void keyPressEvent (QKeyEvent *event)
 This event handler can be reimplemented in a subclass to receive key press events for an item.
 
virtual void keyReleaseEvent (QKeyEvent *event)
 This event handler can be reimplemented in a subclass to receive key release events for an item.
 
virtual void focusInEvent (QFocusEvent *)
 This event handler can be reimplemented in a subclass to receive focus-in events for an item.
 
virtual void focusOutEvent (QFocusEvent *)
 This event handler can be reimplemented in a subclass to receive focus-out events for an item.
 
virtual void mouseMoveEvent (QMouseEvent *event)
 This event handler can be reimplemented in a subclass to receive mouse move events for an item.
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 This event handler can be reimplemented in a subclass to receive mouse double-click events for an item.
 
virtual void mouseUngrabEvent ()
 This event handler can be reimplemented in a subclass to be notified when a mouse ungrab event has occurred on this item.
 
virtual void touchUngrabEvent ()
 This event handler can be reimplemented in a subclass to be notified when a touch ungrab event has occurred on this item.
 
virtual void touchEvent (QTouchEvent *event)
 This event handler can be reimplemented in a subclass to receive touch events for an item.
 
virtual bool childMouseEventFilter (QQuickItem *, QEvent *)
 Reimplement this method to filter the pointer events that are received by this item's children.
 
virtual void releaseResources ()
 This function is called when an item should release graphics resources which are not already managed by the nodes returned from QQuickItem::updatePaintNode().
 
 QQuickItem (QQuickItemPrivate &dd, QQuickItem *parent=nullptr)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 

Properties

QString text
 
QFont font
 
QColor color
 
QColor linkColor
 
TextStyle style
 
QColor styleColor
 
HAlignment horizontalAlignment
 
HAlignment effectiveHorizontalAlignment
 
VAlignment verticalAlignment
 
WrapMode wrapMode
 
int lineCount
 
bool truncated
 
int maximumLineCount
 
TextFormat textFormat
 
TextElideMode elide
 
qreal contentWidth
 
qreal contentHeight
 
qreal paintedWidth
 
qreal paintedHeight
 
qreal lineHeight
 
LineHeightMode lineHeightMode
 
QUrl baseUrl
 
int minimumPixelSize
 
int minimumPointSize
 
FontSizeMode fontSizeMode
 
RenderType renderType
 
QString hoveredLink
 
int renderTypeQuality
 
qreal padding
 
qreal topPadding
 
qreal leftPadding
 
qreal rightPadding
 
qreal bottomPadding
 
QJSValue fontInfo
 
QSizeF advance
 
- Properties inherited from QQuickImplicitSizeItem
qreal implicitWidth
 
qreal implicitHeight
 
- Properties inherited from QQuickItem
QQuickItemparent
 \qmlproperty Item QtQuick::Item::parent This property holds the visual parent of the item.
 
qreal x
 \qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item::width \qmlproperty real QtQuick::Item::height
 
qreal y
 Defines the item's y position relative to its parent.
 
qreal z
 \qmlproperty real QtQuick::Item::z
 
qreal width
 This property holds the width of this item.
 
qreal height
 This property holds the height of this item.
 
qreal opacity
 \qmlproperty real QtQuick::Item::opacity
 
bool enabled
 \qmlproperty bool QtQuick::Item::enabled
 
bool visible
 \qmlproperty bool QtQuick::Item::visible
 
Qt::FocusPolicy focusPolicy
 \qmlproperty enumeration QtQuick::Item::focusPolicy
 
qreal rotation
 \qmlproperty real QtQuick::Item::rotation This property holds the rotation of the item in degrees clockwise around its transformOrigin.
 
qreal scale
 \qmlproperty real QtQuick::Item::scale This property holds the scale factor for this item.
 
TransformOrigin transformOrigin
 \qmlproperty enumeration QtQuick::Item::transformOrigin This property holds the origin point around which scale and rotation transform.
 
QPointF transformOriginPoint
 
QQmlListProperty< QQuickTransformtransform
 \qmlproperty list<Transform> QtQuick::Item::transform This property holds the list of transformations to apply.
 
bool smooth
 \qmlproperty bool QtQuick::Item::smooth
 
bool antialiasing
 \qmlproperty bool QtQuick::Item::antialiasing
 
qreal implicitWidth
 
qreal implicitHeight
 
QObjectcontainmentMask
 \qmlproperty QObject* QtQuick::Item::containmentMask
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Additional Inherited Members

- Public Slots inherited from QQuickItem
void update ()
 Schedules a call to updatePaintNode() for this item.
 
- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 

Detailed Description

Definition at line 27 of file qquicktext_p.h.

Member Enumeration Documentation

◆ FontSizeMode

Enumerator
FixedSize 
HorizontalFit 
VerticalFit 
Fit 

Definition at line 128 of file qquicktext_p.h.

◆ HAlignment

Enumerator
AlignLeft 
AlignRight 
AlignHCenter 
AlignJustify 

Definition at line 77 of file qquicktext_p.h.

◆ LineHeightMode

Enumerator
ProportionalHeight 
FixedHeight 

Definition at line 125 of file qquicktext_p.h.

◆ RenderType

Enumerator
QtRendering 
NativeRendering 
CurveRendering 

Definition at line 111 of file qquicktext_p.h.

◆ RenderTypeQuality

Enumerator
DefaultRenderTypeQuality 
LowRenderTypeQuality 
NormalRenderTypeQuality 
HighRenderTypeQuality 
VeryHighRenderTypeQuality 

Definition at line 117 of file qquicktext_p.h.

◆ TextElideMode

Enumerator
ElideLeft 
ElideRight 
ElideMiddle 
ElideNone 

Definition at line 97 of file qquicktext_p.h.

◆ TextFormat

Enumerator
PlainText 
RichText 
MarkdownText 
AutoText 
StyledText 

Definition at line 91 of file qquicktext_p.h.

◆ TextStyle

Enumerator
Normal 
Outline 
Raised 
Sunken 

Definition at line 86 of file qquicktext_p.h.

◆ VAlignment

Enumerator
AlignTop 
AlignBottom 
AlignVCenter 

Definition at line 82 of file qquicktext_p.h.

◆ WrapMode

Enumerator
NoWrap 
WordWrap 
WrapAnywhere 
WrapAtWordBoundaryOrAnywhere 
Wrap 

Definition at line 103 of file qquicktext_p.h.

Constructor & Destructor Documentation

◆ QQuickText() [1/2]

QQuickText::QQuickText ( QQuickItem * parent = nullptr)

\qmltype Text \instantiates QQuickText \inqmlmodule QtQuick\inherits Item

Specifies how to add formatted text to a scene.

Text items can display both plain and rich text. For example, you can define red text with a specific font and size like this:

\qml Text { text: "Hello World!" font.family: "Helvetica" font.pointSize: 24 color: "red" } \endqml

Use HTML-style markup or Markdown to define rich text:

Definition at line 1448 of file qquicktext.cpp.

References d.

◆ ~QQuickText()

QQuickText::~QQuickText ( )
override

Definition at line 1462 of file qquicktext.cpp.

References d, and qDeleteAll().

+ Here is the call graph for this function:

◆ QQuickText() [2/2]

QQuickText::QQuickText ( QQuickTextPrivate & dd,
QQuickItem * parent = nullptr )
protected

Definition at line 1455 of file qquicktext.cpp.

References d.

Member Function Documentation

◆ advance()

QSizeF QQuickText::advance ( ) const

\qmlproperty size QtQuick::Text::advance

Since
5.10

The distance, in pixels, from the baseline origin of the first character of the text item, to the baseline origin of the first character in a text item occurring directly after this one in a text flow.

Note that the advance can be negative if the text flows from right to left.

Definition at line 3592 of file qquicktext.cpp.

References d.

◆ baseUrl()

QUrl QQuickText::baseUrl ( ) const

\qmlproperty url QtQuick::Text::baseUrl

This property specifies a base URL that is used to resolve relative URLs within the text.

Urls are resolved to be within the same directory as the target of the base URL meaning any portion of the path after the last '/' will be ignored.

\table \header

The default value is the url of the QML file instantiating the Text item.

Definition at line 2518 of file qquicktext.cpp.

References context, d, and qmlContext().

+ Here is the call graph for this function:

◆ baseUrlChanged

void QQuickText::baseUrlChanged ( )
signal

Referenced by setBaseUrl().

+ Here is the caller graph for this function:

◆ bottomPadding()

qreal QQuickText::bottomPadding ( ) const

Definition at line 3484 of file qquicktext.cpp.

References d.

◆ boundingRect()

QRectF QQuickText::boundingRect ( ) const
overridevirtual

Returns the extents of the text after layout.

If the \l style() is not Text.Normal, a margin is added to ensure that the rendering effect will fit within this rectangle.

See also
contentWidth(), contentHeight(), clipRect()

Reimplemented from QQuickItem.

Definition at line 2568 of file qquicktext.cpp.

References QQuickTextUtil::alignedX(), QQuickTextUtil::alignedY(), d, effectiveHAlign(), Normal, and rect.

+ Here is the call graph for this function:

◆ clipRect()

QRectF QQuickText::clipRect ( ) const
overridevirtual

Returns a rectangular area slightly larger than what is currently visible in \l viewportItem(); otherwise, the rectangle (0, 0, width, height).

The text will be clipped to fit if \l clip is true.

Note
If the \l style is not Text.Normal, the clip rectangle is adjusted to be slightly larger, to limit clipping of the outline effect at the edges. But it still looks better to set \l clip to false in that case.
See also
contentWidth(), contentHeight(), boundingRect()

Reimplemented from QQuickItem.

Definition at line 2594 of file qquicktext.cpp.

References QQuickItem::clipRect(), d, Normal, and rect.

Referenced by updatePaintNode(), and updatePolish().

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

◆ color()

QColor QQuickText::color ( ) const

\qmlproperty color QtQuick::Text::color

The text color.

An example of green text defined using hexadecimal notation: \qml Text { color: "#00FF00" text: "green text" } \endqml

An example of steel blue text defined using an SVG color name: \qml Text { color: "steelblue" text: "blue text" } \endqml

Definition at line 1992 of file qquicktext.cpp.

References d, and QColor::fromRgba().

+ Here is the call graph for this function:

◆ colorChanged

void QQuickText::colorChanged ( )
signal

Referenced by setColor().

+ Here is the caller graph for this function:

◆ componentComplete()

void QQuickText::componentComplete ( )
overridevirtual

Reimplemented from QQuickItem.

Definition at line 3000 of file qquicktext.cpp.

References QQuickItem::componentComplete(), and d.

Referenced by QQuickPlaceholderText::componentComplete(), and QQuickLabel::componentComplete().

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

◆ contentHeight()

qreal QQuickText::contentHeight ( ) const

\qmlproperty real QtQuick::Text::contentHeight

Returns the height of the text, including height past the height that is covered due to there being more text than fits in the set height.

Definition at line 2809 of file qquicktext.cpp.

References d, and qMax().

+ Here is the call graph for this function:

◆ contentHeightChanged

void QQuickText::contentHeightChanged ( qreal contentHeight)
signal

◆ contentSizeChanged

void QQuickText::contentSizeChanged ( )
signal

◆ contentWidth()

qreal QQuickText::contentWidth ( ) const

\qmlproperty real QtQuick::Text::contentWidth

Returns the width of the text, including width past the width that is covered due to insufficient wrapping if WrapMode is set.

Definition at line 2797 of file qquicktext.cpp.

References d.

◆ contentWidthChanged

void QQuickText::contentWidthChanged ( qreal contentWidth)
signal

◆ effectiveHAlign()

QQuickText::HAlignment QQuickText::effectiveHAlign ( ) const

Definition at line 2170 of file qquicktext.cpp.

References AlignLeft, AlignRight, and d.

Referenced by boundingRect(), geometryChange(), and updatePaintNode().

+ Here is the caller graph for this function:

◆ effectiveHorizontalAlignmentChanged

void QQuickText::effectiveHorizontalAlignmentChanged ( )
signal

Referenced by QQuickMaterialPlaceholderText::QQuickMaterialPlaceholderText(), and QQuickPlaceholderText::componentComplete().

+ Here is the caller graph for this function:

◆ elideMode()

QQuickText::TextElideMode QQuickText::elideMode ( ) const

\qmlproperty enumeration QtQuick::Text::elide

Set this property to elide parts of the text fit to the Text item's width. The text will only elide if an explicit width has been set.

This property cannot be used with rich text.

Eliding can be:

\value Text.ElideNone - the default \value Text.ElideLeft \value Text.ElideMiddle \value Text.ElideRight

If this property is set to Text.ElideRight, it can be used with \l {wrapMode}{wrapped} text. The text will only elide if maximumLineCount, or height has been set. If both maximumLineCount and height are set, maximumLineCount will apply unless the lines do not fit in the height allowed.

If the text is a multi-length string, and the mode is not Text.ElideNone, the first string that fits will be used, otherwise the last will be elided.

Multi-length strings are ordered from longest to shortest, separated by the Unicode "String Terminator" character U009C (write this in QML with {"\u009C"} or {"\x9C"}).

Definition at line 2477 of file qquicktext.cpp.

References d.

◆ elideModeChanged

void QQuickText::elideModeChanged ( QQuickText::TextElideMode mode)
signal

Referenced by setElideMode().

+ Here is the caller graph for this function:

◆ font()

QFont QQuickText::font ( ) const

\qmlproperty bool QtQuick::Text::clip This property holds whether the text is clipped.

Note that if the text does not fit in the bounding rectangle, it will be abruptly chopped.

If you want to display potentially long text in a limited space, you probably want to use elide instead.

\qmlsignal QtQuick::Text::lineLaidOut(object line)

This signal is emitted for each line of text that is laid out during the layout process in plain text or styled text mode. It is not emitted in rich text mode. The specified line object provides more details about the line that is currently being laid out.

This gives the opportunity to position and resize a line as it is being laid out. It can for example be used to create columns or lay out text around objects.

The properties of the specified line object are:

\table \header

  • Property name
  • Description \row
  • number (read-only)
  • Line number, starts with zero. \row
  • x
  • Specifies the line's x position inside the Text element. \row
  • y
  • Specifies the line's y position inside the Text element. \row
  • width
  • Specifies the width of the line. \row
  • height
  • Specifies the height of the line. \row
  • implicitWidth (read-only)
  • The width that the line would naturally occupy based on its contents, not taking into account any modifications made to width. \row
  • isLast (read-only)
  • Whether the line is the last. This property can change if you set the width property to a different value. \endtable

For example, this will move the first 5 lines of a Text item by 100 pixels to the right:

onLineLaidOut: (line)=> {
if (line.number < 5) {
line.x = line.x + 100
line.width = line.width - 100
}
}
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:8084

The following example will allow you to position an item at the end of the last line:

onLineLaidOut: (line)=> {
if (line.isLast) {
lastLineMarker.x = line.x + line.implicitWidth
lastLineMarker.y = line.y + (line.height - lastLineMarker.height) / 2
}
}

\qmlsignal QtQuick::Text::linkActivated(string link)

This signal is emitted when the user clicks on a link embedded in the text. The link must be in rich text or HTML format and the link string provides access to the particular link.

Text {
textFormat: Text.RichText
text: "See the <a href=\"http://qt-project.org\">Qt Project website</a>."
onLinkActivated: (link)=> console.log(link + " link activated")
}

The example code will display the text "See the \l{http://qt-project.org}{Qt Project website}."

Clicking on the highlighted link will output \tt{http://qt-project.org link activated} to the console.

\qmlproperty string QtQuick::Text::font.family

Sets the family name of the font.

The family name is case insensitive and may optionally include a foundry name, for example "Helvetica [Cronyx]". If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen. If the family isn't available a family will be set using the font matching algorithm.

\qmlproperty string QtQuick::Text::font.styleName

Since
5.6

Sets the style name of the font.

The style name is case insensitive. If set, the font will be matched against style name instead of the font properties \l font.weight, \l font.bold and \l font.italic.

\qmlproperty bool QtQuick::Text::font.bold

Sets whether the font weight is bold.

\qmlproperty int QtQuick::Text::font.weight

The requested weight of the font. The weight requested must be an integer between 1 and 1000, or one of the predefined values:

\value Font.Thin 100 \value Font.ExtraLight 200 \value Font.Light 300 \value Font.Normal 400 (default) \value Font.Medium 500 \value Font.DemiBold 600 \value Font.Bold 700 \value Font.ExtraBold 800 \value Font.Black 900

\qml Text { text: "Hello"; font.weight: Font.DemiBold } \endqml

\qmlproperty bool QtQuick::Text::font.italic

Sets whether the font has an italic style.

\qmlproperty bool QtQuick::Text::font.underline

Sets whether the text is underlined.

\qmlproperty bool QtQuick::Text::font.strikeout

Sets whether the font has a strikeout style.

\qmlproperty real QtQuick::Text::font.pointSize

Sets the font size in points. The point size must be greater than zero.

\qmlproperty int QtQuick::Text::font.pixelSize

Sets the font size in pixels.

Using this function makes the font device dependent. Use pointSize to set the size of the font in a device independent manner.

\qmlproperty real QtQuick::Text::font.letterSpacing

Sets the letter spacing for the font.

Letter spacing changes the default spacing between individual letters in the font. A positive value increases the letter spacing by the corresponding pixels; a negative value decreases the spacing.

\qmlproperty real QtQuick::Text::font.wordSpacing

Sets the word spacing for the font.

Word spacing changes the default spacing between individual words. A positive value increases the word spacing by a corresponding amount of pixels, while a negative value decreases the inter-word spacing accordingly.

\qmlproperty enumeration QtQuick::Text::font.capitalization

Sets the capitalization for the text.

\value Font.MixedCase the normal case: no capitalization change is applied \value Font.AllUppercase alters the text to be rendered in all uppercase type \value Font.AllLowercase alters the text to be rendered in all lowercase type \value Font.SmallCaps alters the text to be rendered in small-caps type \value Font.Capitalize alters the text to be rendered with the first character of each word as an uppercase character

\qml Text { text: "Hello"; font.capitalization: Font.AllLowercase } \endqml

\qmlproperty enumeration QtQuick::Text::font.hintingPreference

Since
5.8

Sets the preferred hinting on the text. This is a hint to the underlying text rendering system to use a certain level of hinting, and has varying support across platforms. See the table in the documentation for QFont::HintingPreference for more details.

Note
This property only has an effect when used together with render type Text.NativeRendering.

\value Font.PreferDefaultHinting Use the default hinting level for the target platform. \value Font.PreferNoHinting If possible, render text without hinting the outlines of the glyphs. The text layout will be typographically accurate, using the same metrics as are used, for example, when printing. \value Font.PreferVerticalHinting If possible, render text with no horizontal hinting, but align glyphs to the pixel grid in the vertical direction. The text will appear crisper on displays where the density is too low to give an accurate rendering of the glyphs. But since the horizontal metrics of the glyphs are unhinted, the text's layout will be scalable to higher density devices (such as printers) without impacting details such as line breaks. \value Font.PreferFullHinting If possible, render text with hinting in both horizontal and vertical directions. The text will be altered to optimize legibility on the target device, but since the metrics will depend on the target size of the text, the positions of glyphs, line breaks, and other typographical detail will not scale, meaning that a text layout may look different on devices with different pixel densities.

\qml Text { text: "Hello"; renderType: Text.NativeRendering; font.hintingPreference: Font.PreferVerticalHinting } \endqml

\qmlproperty bool QtQuick::Text::font.kerning

Since
5.10

Enables or disables the kerning OpenType feature when shaping the text. Disabling this may improve performance when creating or changing the text, at the expense of some cosmetic features. The default value is true.

\qml Text { text: "OATS FLAVOUR WAY"; font.kerning: false } \endqml

\qmlproperty bool QtQuick::Text::font.preferShaping

Since
5.10

Sometimes, a font will apply complex rules to a set of characters in order to display them correctly. In some writing systems, such as Brahmic scripts, this is required in order for the text to be legible, but in for example Latin script, it is merely a cosmetic feature. Setting the preferShaping property to false will disable all such features when they are not required, which will improve performance in most cases.

The default value is true.

\qml Text { text: "Some text"; font.preferShaping: false } \endqml

\qmlproperty object QtQuick::Text::font.variableAxes
\since 6.7

! [qml-font-variable-axes] Applies floating point values to variable axes in variable fonts.

Variable fonts provide a way to store multiple variations (with different weights, widths or styles) in the same font file. The variations are given as floating point values for a pre-defined set of parameters, called "variable axes". Specific instances are typically given names by the font designer, and, in Qt, these can be selected using setStyleName() just like traditional sub-families.

In some cases, it is also useful to provide arbitrary values for the different axes. For instance, if a font has a Regular and Bold sub-family, you may want a weight in-between these. You could then manually request this by supplying a custom value for the "wght" axis in the font.

\qml Text { text: "Foobar" font.family: "MyVariableFont" font.variableAxes: { "wght": (Font.Normal + Font.Bold) / 2.0 } } \endqml

If the "wght" axis is supported by the font and the given value is within its defined range, a font corresponding to the weight 550.0 will be provided.

There are a few standard axes than many fonts provide, such as "wght" (weight), "wdth" (width), "ital" (italic) and "opsz" (optical size). They each have indivdual ranges defined in the font itself. For instance, "wght" may span from 100 to 900 (QFont::Thin to QFont::Black) whereas "ital" can span from 0 to 1 (from not italic to fully italic).

A font may also choose to define custom axes; the only limitation is that the name has to meet the requirements for a QFont::Tag (sequence of four latin-1 characters.)

By default, no variable axes are set.

Note
On Windows, variable axes are not supported if the optional GDI font backend is in use.
See also
QFont::setVariableAxis() ! [qml-font-variable-axes]
\qmlproperty object QtQuick::Text::font.features
\since 6.6

! [qml-font-features] Applies integer values to specific OpenType features when shaping the text based on the contents in features. This provides advanced access to the font shaping process, and can be used to support font features that are otherwise not covered in the API.

The font features are represented by a map from four-letter tags to integer values. This integer value passed along with the tag in most cases represents a boolean value: A zero value means the feature is disabled, and a non-zero value means it is enabled. For certain font features, however, it may have other interpretations. For example, when applied to the salt feature, the value is an index that specifies the stylistic alternative to use.

For example, the frac font feature will convert diagonal fractions separated with a slash (such as 1/2) with a different representation. Typically this will involve baking the full fraction into a single character width (such as ½).

If a font supports the frac feature, then it can be enabled in the shaper as in the following code:

\qml Text { text: "One divided by two is 1/2" font.family: "MyFractionFont" font.features: { "frac": 1 } } \endqml

Multiple features can be assigned values in the same mapping. For instance, if you would like to also disable kerning for the font, you can explicitly disable this as follows:

\qml Text { text: "One divided by two is 1/2" font.family: "MyFractionFont" font.features: { "frac": 1, "kern": 0 } } \endqml

You can also collect the font properties in an object:

\qml Text { text: "One divided by two is 1/2" font: { family: "MyFractionFont" features: { "frac": 1, "kern": 0 } } } \endqml

Note
By default, Qt will enable and disable certain font features based on other font properties. In particular, the kern feature will be enabled/disabled depending on the \l font.kerning property of the QFont. In addition, all ligature features (liga, clig, dlig, hlig) will be disabled if a \l font.letterSpacing is set, but only for writing systems where the use of ligature is cosmetic. For writing systems where ligatures are required, the features will remain in their default state. The values set using font.features will override the default behavior. If, for instance, {"kern"} is set to 1, then kerning will always be enabled, regardless of whether the \l font.kerning property is set to false. Similarly, if it is set to 0, it will always be disabled.
See also
QFont::setFeature() ! [qml-font-features]

Definition at line 1850 of file qquicktext.cpp.

References d.

◆ fontChanged

void QQuickText::fontChanged ( const QFont & font)
signal

Referenced by setFont().

+ Here is the caller graph for this function:

◆ fontInfo()

QJSValue QQuickText::fontInfo ( ) const

\qmlproperty string QtQuick::Text::fontInfo.family

Since
5.9

The family name of the font that has been resolved for the current font and fontSizeMode.

\qmlproperty string QtQuick::Text::fontInfo.styleName

Since
5.9

The style name of the font info that has been resolved for the current font and fontSizeMode.

\qmlproperty bool QtQuick::Text::fontInfo.bold

Since
5.9

The bold state of the font info that has been resolved for the current font and fontSizeMode. This is true if the weight of the resolved font is bold or higher.

\qmlproperty int QtQuick::Text::fontInfo.weight

Since
5.9

The weight of the font info that has been resolved for the current font and fontSizeMode.

\qmlproperty bool QtQuick::Text::fontInfo.italic

Since
5.9

The italic state of the font info that has been resolved for the current font and fontSizeMode.

\qmlproperty real QtQuick::Text::fontInfo.pointSize

Since
5.9

The pointSize of the font info that has been resolved for the current font and fontSizeMode.

\qmlproperty int QtQuick::Text::fontInfo.pixelSize

Since
5.9

The pixel size of the font info that has been resolved for the current font and fontSizeMode.

Definition at line 3559 of file qquicktext.cpp.

References d, engine, QJSEngine::newObject(), qjsEngine(), qmlWarning(), QStringLiteral, and QJSValue::setProperty().

+ Here is the call graph for this function:

◆ fontSizeMode()

QQuickText::FontSizeMode QQuickText::fontSizeMode ( ) const

\qmlproperty enumeration QtQuick::Text::fontSizeMode

This property specifies how the font size of the displayed text is determined. The possible values are:

\value Text.FixedSize (default) The size specified by \l font.pixelSize or \l font.pointSize is used. \value Text.HorizontalFit The largest size up to the size specified that fits within the width of the item without wrapping is used. \value Text.VerticalFit The largest size up to the size specified that fits the height of the item is used. \value Text.Fit The largest size up to the size specified that fits within the width and height of the item is used.

The font size of fitted text has a minimum bound specified by the minimumPointSize or minimumPixelSize property and maximum bound specified by either the \l font.pointSize or \l font.pixelSize properties.

\qml Text { text: "Hello"; fontSizeMode: Text.Fit; minimumPixelSize: 10; font.pixelSize: 72 } \endqml

If the text does not fit within the item bounds with the minimum font size the text will be elided as per the \l elide property.

If the \l textFormat property is set to Text.RichText, this will have no effect at all as the property will be ignored completely. If \l textFormat is set to Text.StyledText, then the property will be respected provided there is no font size tags inside the text. If there are font size tags, the property will still respect those. This can cause it to not fully comply with the fontSizeMode setting.

Definition at line 2909 of file qquicktext.cpp.

References d.

◆ fontSizeModeChanged

void QQuickText::fontSizeModeChanged ( )
signal

Referenced by setFontSizeMode().

+ Here is the caller graph for this function:

◆ geometryChange()

void QQuickText::geometryChange ( const QRectF & newGeometry,
const QRectF & oldGeometry )
overrideprotectedvirtual

Reimplemented from QQuickItem.

Definition at line 2605 of file qquicktext.cpp.

References AlignLeft, AlignTop, d, effectiveHAlign(), elide, ElideNone, ElideRight, FixedSize, QQuickItem::geometryChange(), QRectF::height(), QQuickItem::heightChanged(), QQuickItem::heightValid(), NoWrap, qFuzzyIsNull(), QQuickItem::update(), QQuickTextPrivate::UpdatePaintNode, VerticalFit, QRectF::width(), QQuickItem::widthChanged(), and QQuickItem::widthValid().

Referenced by QQuickLabel::geometryChange().

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

◆ hAlign()

QQuickText::HAlignment QQuickText::hAlign ( ) const

\qmlproperty enumeration QtQuick::Text::horizontalAlignment \qmlproperty enumeration QtQuick::Text::verticalAlignment \qmlproperty enumeration QtQuick::Text::effectiveHorizontalAlignment

Sets the horizontal and vertical alignment of the text within the Text items width and height. By default, the text is vertically aligned to the top. Horizontal alignment follows the natural alignment of the text, for example text that is read from left to right will be aligned to the left.

The valid values for horizontalAlignment are Text.AlignLeft, Text.AlignRight, Text.AlignHCenter and Text.AlignJustify. The valid values for verticalAlignment are Text.AlignTop, Text.AlignBottom and Text.AlignVCenter.

Note that for a single line of text, the size of the text is the area of the text. In this common case, all alignments are equivalent. If you want the text to be, say, centered in its parent, then you will need to either modify the Item::anchors, or set horizontalAlignment to Text.AlignHCenter and bind the width to that of the parent.

When using the attached property LayoutMirroring::enabled to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property horizontalAlignment will remain unchanged. To query the effective horizontal alignment of Text, use the read-only property effectiveHorizontalAlignment.

Definition at line 2147 of file qquicktext.cpp.

References d.

◆ horizontalAlignmentChanged

void QQuickText::horizontalAlignmentChanged ( QQuickText::HAlignment alignment)
signal

◆ hoveredLink()

QString QQuickText::hoveredLink ( ) const

\qmlsignal QtQuick::Text::linkHovered(string link)

Since
5.2

This signal is emitted when the user hovers a link embedded in the text. The link must be in rich text or HTML format and the link string provides access to the particular link.

See also
hoveredLink, linkAt()

\qmlproperty string QtQuick::Text::hoveredLink

Since
5.2

This property contains the link string when the user hovers a link embedded in the text. The link must be in rich text or HTML format and the hoveredLink string provides access to the particular link.

See also
linkHovered, linkAt()

Definition at line 3162 of file qquicktext.cpp.

References d, QQuickItem::mapToScene(), pos, QCursor::pos(), and QQuickItem::window().

+ Here is the call graph for this function:

◆ hoverEnterEvent()

void QQuickText::hoverEnterEvent ( QHoverEvent * event)
overrideprotectedvirtual

This event handler can be reimplemented in a subclass to receive hover-enter events for an item.

The event information is provided by the event parameter.

Hover events are only provided if acceptHoverEvents() is true.

\input item.qdocinc accepting-events

Reimplemented from QQuickItem.

Definition at line 3196 of file qquicktext.cpp.

References d.

◆ hoverLeaveEvent()

void QQuickText::hoverLeaveEvent ( QHoverEvent * event)
overrideprotectedvirtual

This event handler can be reimplemented in a subclass to receive hover-leave events for an item.

The event information is provided by the event parameter.

Hover events are only provided if acceptHoverEvents() is true.

\input item.qdocinc accepting-events

Reimplemented from QQuickItem.

Definition at line 3208 of file qquicktext.cpp.

References d.

◆ hoverMoveEvent()

void QQuickText::hoverMoveEvent ( QHoverEvent * event)
overrideprotectedvirtual

This event handler can be reimplemented in a subclass to receive hover-move events for an item.

The event information is provided by the event parameter.

Hover events are only provided if acceptHoverEvents() is true.

\input item.qdocinc accepting-events

Reimplemented from QQuickItem.

Definition at line 3202 of file qquicktext.cpp.

References d.

◆ invalidate()

void QQuickText::invalidate ( )
overridevirtual

Implements QQuickTextInterface.

Definition at line 3214 of file qquicktext.cpp.

References d, and QMetaObject::invokeMethod().

+ Here is the call graph for this function:

◆ invalidateFontCaches()

void QQuickText::invalidateFontCaches ( )
protected

Invalidates font caches owned by the text objects owned by the element to work around the fact that text objects cannot be used from multiple threads.

Definition at line 3367 of file qquicktext.cpp.

References d, QTextLayout::engine(), QTextBlock::isValid(), QTextBlock::layout(), QTextBlock::next(), and QTextEngine::resetFontEngineCache().

Referenced by updatePaintNode(), and updatePolish().

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

◆ itemChange()

void QQuickText::itemChange ( ItemChange change,
const ItemChangeData & value )
overrideprotectedvirtual

Called when change occurs for this item.

value contains extra information relating to the change, when applicable.

If you re-implement this method in a subclass, be sure to call

virtual void itemChange(ItemChange, const ItemChangeData &)
Called when change occurs for this item.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]

typically at the end of your implementation, to ensure the \l windowChanged() signal will be emitted.

Reimplemented from QQuickItem.

Definition at line 1888 of file qquicktext.cpp.

References QQuickItem::antialiasing, d, QQuickItem::ItemAntialiasingHasChanged, QQuickItem::itemChange(), QQuickItem::ItemDevicePixelRatioHasChanged, NativeRendering, QFont::NoAntialias, QFont::PreferAntialias, and Q_UNUSED.

Referenced by QQuickLabel::itemChange().

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

◆ leftPadding()

qreal QQuickText::leftPadding ( ) const

Definition at line 3444 of file qquicktext.cpp.

References d.

◆ lineCount()

int QQuickText::lineCount ( ) const

\qmlproperty int QtQuick::Text::lineCount

Returns the number of lines visible in the text item.

This property is not supported for rich text.

See also
maximumLineCount

Definition at line 2293 of file qquicktext.cpp.

References d.

◆ lineCountChanged

void QQuickText::lineCountChanged ( )
signal

◆ lineHeight()

qreal QQuickText::lineHeight ( ) const

\qmlproperty real QtQuick::Text::lineHeight

Sets the line height for the text. The value can be in pixels or a multiplier depending on lineHeightMode.

The default value is a multiplier of 1.0. The line height must be a positive value.

Definition at line 2824 of file qquicktext.cpp.

References d.

◆ lineHeightChanged

void QQuickText::lineHeightChanged ( qreal lineHeight)
signal

Referenced by setLineHeight().

+ Here is the caller graph for this function:

◆ lineHeightMode()

QQuickText::LineHeightMode QQuickText::lineHeightMode ( ) const

\qmlproperty enumeration QtQuick::Text::lineHeightMode

This property determines how the line height is specified. The possible values are:

\value Text.ProportionalHeight (default) sets the spacing proportional to the line (as a multiplier). For example, set to 2 for double spacing. \value Text.FixedHeight sets the line height to a fixed line height (in pixels).

Definition at line 2854 of file qquicktext.cpp.

References d.

◆ lineHeightModeChanged

void QQuickText::lineHeightModeChanged ( LineHeightMode mode)
signal

Referenced by setLineHeightMode().

+ Here is the caller graph for this function:

◆ lineLaidOut

void QQuickText::lineLaidOut ( QQuickTextLine * line)
signal

◆ linkActivated

void QQuickText::linkActivated ( const QString & link)
signal

Referenced by mouseReleaseEvent().

+ Here is the caller graph for this function:

◆ linkColor()

QColor QQuickText::linkColor ( ) const

\qmlproperty color QtQuick::Text::linkColor

The color of links in the text.

This property works with the StyledText \l textFormat, but not with RichText. Link color in RichText can be specified by including CSS style tags in the text.

Definition at line 2023 of file qquicktext.cpp.

References d, and QColor::fromRgba().

+ Here is the call graph for this function:

◆ linkColorChanged

void QQuickText::linkColorChanged ( )
signal

Referenced by setLinkColor().

+ Here is the caller graph for this function:

◆ maximumLineCount()

int QQuickText::maximumLineCount ( ) const

\qmlproperty int QtQuick::Text::maximumLineCount

Set this property to limit the number of lines that the text item will show. If elide is set to Text.ElideRight, the text will be elided appropriately. By default, this is the value of the largest possible integer.

This property is not supported for rich text.

See also
lineCount, elide

Definition at line 2326 of file qquicktext.cpp.

References d.

◆ maximumLineCountChanged

void QQuickText::maximumLineCountChanged ( )
signal

Referenced by setMaximumLineCount().

+ Here is the caller graph for this function:

◆ minimumPixelSize()

int QQuickText::minimumPixelSize ( ) const

\qmlproperty int QtQuick::Text::minimumPixelSize

This property specifies the minimum font pixel size of text scaled by the fontSizeMode property.

If the fontSizeMode is Text.FixedSize or the \l font.pixelSize is -1 this property is ignored.

Definition at line 2938 of file qquicktext.cpp.

References d.

◆ minimumPixelSizeChanged

void QQuickText::minimumPixelSizeChanged ( )
signal

Referenced by setMinimumPixelSize().

+ Here is the caller graph for this function:

◆ minimumPointSize()

int QQuickText::minimumPointSize ( ) const

\qmlproperty int QtQuick::Text::minimumPointSize

This property specifies the minimum font point \l size of text scaled by the fontSizeMode property.

If the fontSizeMode is Text.FixedSize or the \l font.pointSize is -1 this property is ignored.

Definition at line 2968 of file qquicktext.cpp.

References d.

◆ minimumPointSizeChanged

void QQuickText::minimumPointSizeChanged ( )
signal

Referenced by setMinimumPointSize().

+ Here is the caller graph for this function:

◆ mousePressEvent()

void QQuickText::mousePressEvent ( QMouseEvent * event)
overrideprotectedvirtual

Reimplemented from QQuickItem.

Definition at line 3061 of file qquicktext.cpp.

References d, QString::isEmpty(), and QQuickItem::mousePressEvent().

+ Here is the call graph for this function:

◆ mouseReleaseEvent()

void QQuickText::mouseReleaseEvent ( QMouseEvent * event)
overrideprotectedvirtual

Reimplemented from QQuickItem.

Definition at line 3083 of file qquicktext.cpp.

References d, emit, QString::isEmpty(), linkActivated(), and QQuickItem::mouseReleaseEvent().

+ Here is the call graph for this function:

◆ padding()

qreal QQuickText::padding ( ) const
Since
5.6 \qmlproperty real QtQuick::Text::padding \qmlproperty real QtQuick::Text::topPadding \qmlproperty real QtQuick::Text::leftPadding \qmlproperty real QtQuick::Text::bottomPadding \qmlproperty real QtQuick::Text::rightPadding

These properties hold the padding around the content. This space is reserved in addition to the contentWidth and contentHeight.

Definition at line 3394 of file qquicktext.cpp.

References d.

◆ Q_REVISION [1/10]

QQuickText::Q_REVISION ( 2 ,
2  ) const &
signal

◆ Q_REVISION() [2/10]

QQuickText::Q_REVISION ( 2 ,
3  )

◆ Q_REVISION [3/10]

QQuickText::Q_REVISION ( 2 ,
6  )
signal

◆ Q_REVISION [4/10]

QQuickText::Q_REVISION ( 2 ,
6  )
signal

◆ Q_REVISION [5/10]

QQuickText::Q_REVISION ( 2 ,
6  )
signal

◆ Q_REVISION [6/10]

QQuickText::Q_REVISION ( 2 ,
6  )
signal

◆ Q_REVISION [7/10]

QQuickText::Q_REVISION ( 2 ,
6  )
signal

◆ Q_REVISION() [8/10]

QQuickText::Q_REVISION ( 2 ,
9  )

◆ Q_REVISION [9/10]

QQuickText::Q_REVISION ( 2 ,
9  )
signal

◆ Q_REVISION [10/10]

QQuickText::Q_REVISION ( 6 ,
0  )
signal

◆ renderType()

QQuickText::RenderType QQuickText::renderType ( ) const

\qmlproperty enumeration QtQuick::Text::renderType

Override the default rendering type for this component.

Supported render types are:

\value Text.QtRendering Text is rendered using a scalable distance field for each glyph. \value Text.NativeRendering Text is rendered using a platform-specific technique. \value Text.CurveRendering Text is rendered using a curve rasterizer running directly on the graphics hardware. (Introduced in Qt 6.7.0.)

Select Text.NativeRendering if you prefer text to look native on the target platform and do not require advanced features such as transformation of the text. Using such features in combination with the NativeRendering render type will lend poor and sometimes pixelated results.

Both Text.QtRendering and Text.CurveRendering are hardware-accelerated techniques. QtRendering is the faster of the two, but uses more memory and will exhibit rendering artifacts at large sizes. CurveRendering should be considered as an alternative in cases where QtRendering does not give good visual results or where reducing graphics memory consumption is a priority.

The default rendering type is determined by \l QQuickWindow::textRenderType().

Definition at line 3300 of file qquicktext.cpp.

References d.

◆ renderTypeChanged

void QQuickText::renderTypeChanged ( )
signal

Referenced by setRenderType().

+ Here is the caller graph for this function:

◆ renderTypeQuality()

int QQuickText::renderTypeQuality ( ) const

\qmlproperty int QtQuick::Text::renderTypeQuality

Since
6.0

Override the default rendering type quality for this component. This is a low-level customization which can be ignored in most cases. It currently only has an effect when \l renderType is Text.QtRendering.

The rasterization algorithm used by Text.QtRendering may give artifacts at large text sizes, such as sharp corners looking rounder than they should. If this is an issue for specific text items, increase the renderTypeQuality to improve rendering quality, at the expense of memory consumption.

The renderTypeQuality may be any integer over 0, or one of the following predefined values

\value Text.DefaultRenderTypeQuality -1 (default) \value Text.LowRenderTypeQuality 26 \value Text.NormalRenderTypeQuality 52 \value Text.HighRenderTypeQuality 104 \value Text.VeryHighRenderTypeQuality 208

Definition at line 3254 of file qquicktext.cpp.

References d.

◆ resetBaseUrl()

void QQuickText::resetBaseUrl ( )

Definition at line 2553 of file qquicktext.cpp.

References context, qmlContext(), and setBaseUrl().

+ Here is the call graph for this function:

◆ resetBottomPadding()

void QQuickText::resetBottomPadding ( )

Definition at line 3498 of file qquicktext.cpp.

References d.

◆ resetHAlign()

void QQuickText::resetHAlign ( )

Definition at line 2162 of file qquicktext.cpp.

References d, and QQuickItem::isComponentComplete().

+ Here is the call graph for this function:

◆ resetLeftPadding()

void QQuickText::resetLeftPadding ( )

Definition at line 3458 of file qquicktext.cpp.

References d.

◆ resetMaximumLineCount()

void QQuickText::resetMaximumLineCount ( )

Definition at line 2345 of file qquicktext.cpp.

References d, emit, setMaximumLineCount(), and truncatedChanged().

+ Here is the call graph for this function:

◆ resetPadding()

void QQuickText::resetPadding ( )

Definition at line 3419 of file qquicktext.cpp.

References setPadding().

+ Here is the call graph for this function:

◆ resetRightPadding()

void QQuickText::resetRightPadding ( )

Definition at line 3478 of file qquicktext.cpp.

References d.

◆ resetTopPadding()

void QQuickText::resetTopPadding ( )

Definition at line 3438 of file qquicktext.cpp.

References d.

◆ resourcesLoading()

int QQuickText::resourcesLoading ( ) const

Returns the number of resources (images) that are being loaded asynchronously.

Definition at line 2991 of file qquicktext.cpp.

References d.

◆ rightPadding()

qreal QQuickText::rightPadding ( ) const

Definition at line 3464 of file qquicktext.cpp.

References d.

◆ setBaseUrl()

void QQuickText::setBaseUrl ( const QUrl & url)

Definition at line 2531 of file qquicktext.cpp.

References baseUrl, baseUrlChanged(), d, emit, qDeleteAll(), and url.

Referenced by resetBaseUrl().

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

◆ setBottomPadding()

void QQuickText::setBottomPadding ( qreal padding)

Definition at line 3492 of file qquicktext.cpp.

References d, and padding.

◆ setColor()

void QQuickText::setColor ( const QColor & c)

Definition at line 1998 of file qquicktext.cpp.

References colorChanged(), d, emit, QQuickItem::isComponentComplete(), QRgb, rgb, QQuickItem::update(), and QQuickTextPrivate::UpdatePaintNode.

+ Here is the call graph for this function:

◆ setElideMode()

void QQuickText::setElideMode ( QQuickText::TextElideMode mode)

Definition at line 2483 of file qquicktext.cpp.

References d, elideModeChanged(), and emit.

Referenced by QQuickCheckLabel::QQuickCheckLabel().

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

◆ setFont()

void QQuickText::setFont ( const QFont & font)

Definition at line 1856 of file qquicktext.cpp.

References QQuickItem::antialiasing, d, emit, font, fontChanged(), QFont::NoAntialias, and qRound().

+ Here is the call graph for this function:

◆ setFontSizeMode()

void QQuickText::setFontSizeMode ( FontSizeMode mode)

Definition at line 2915 of file qquicktext.cpp.

References d, emit, fontSizeModeChanged(), and QQuickItem::polish().

+ Here is the call graph for this function:

◆ setHAlign()

void QQuickText::setHAlign ( HAlignment align)

Definition at line 2153 of file qquicktext.cpp.

References d, and QQuickItem::isComponentComplete().

Referenced by QQuickCheckLabel::QQuickCheckLabel().

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

◆ setLeftPadding()

void QQuickText::setLeftPadding ( qreal padding)

Definition at line 3452 of file qquicktext.cpp.

References d, and padding.

◆ setLineHeight()

void QQuickText::setLineHeight ( qreal lineHeight)

Definition at line 2830 of file qquicktext.cpp.

References d, emit, lineHeight, and lineHeightChanged().

+ Here is the call graph for this function:

◆ setLineHeightMode()

void QQuickText::setLineHeightMode ( LineHeightMode mode)

Definition at line 2860 of file qquicktext.cpp.

References d, emit, and lineHeightModeChanged().

+ Here is the call graph for this function:

◆ setLinkColor()

void QQuickText::setLinkColor ( const QColor & color)

Definition at line 2029 of file qquicktext.cpp.

References d, emit, QQuickItem::isComponentComplete(), linkColorChanged(), QRgb, rgb, QQuickItem::update(), and QQuickTextPrivate::UpdatePaintNode.

+ Here is the call graph for this function:

◆ setMaximumLineCount()

void QQuickText::setMaximumLineCount ( int lines)

Definition at line 2332 of file qquicktext.cpp.

References d, emit, false, and maximumLineCountChanged().

Referenced by resetMaximumLineCount().

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

◆ setMinimumPixelSize()

void QQuickText::setMinimumPixelSize ( int size)

Definition at line 2944 of file qquicktext.cpp.

References d, emit, FixedSize, QQuickItem::heightValid(), minimumPixelSizeChanged(), QQuickItem::polish(), QQuickItem::size(), and QQuickItem::widthValid().

+ Here is the call graph for this function:

◆ setMinimumPointSize()

void QQuickText::setMinimumPointSize ( int size)

Definition at line 2974 of file qquicktext.cpp.

References d, emit, FixedSize, QQuickItem::heightValid(), minimumPointSizeChanged(), QQuickItem::polish(), QQuickItem::size(), and QQuickItem::widthValid().

+ Here is the call graph for this function:

◆ setPadding()

void QQuickText::setPadding ( qreal padding)

Definition at line 3400 of file qquicktext.cpp.

References d, emit, padding, and qFuzzyCompare().

Referenced by resetPadding().

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

◆ setRenderType()

void QQuickText::setRenderType ( QQuickText::RenderType renderType)

Definition at line 3306 of file qquicktext.cpp.

References d, emit, QQuickItem::isComponentComplete(), renderType, and renderTypeChanged().

+ Here is the call graph for this function:

◆ setRenderTypeQuality()

void QQuickText::setRenderTypeQuality ( int renderTypeQuality)

Definition at line 3260 of file qquicktext.cpp.

References d, emit, QQuickItem::isComponentComplete(), renderTypeQuality, QQuickItem::update(), and QQuickTextPrivate::UpdatePaintNode.

+ Here is the call graph for this function:

◆ setRightPadding()

void QQuickText::setRightPadding ( qreal padding)

Definition at line 3472 of file qquicktext.cpp.

References d, and padding.

◆ setStyle()

void QQuickText::setStyle ( QQuickText::TextStyle style)

Definition at line 2073 of file qquicktext.cpp.

References d, emit, QQuickItem::isComponentComplete(), style, styleChanged(), QQuickItem::update(), and QQuickTextPrivate::UpdatePaintNode.

+ Here is the call graph for this function:

◆ setStyleColor()

void QQuickText::setStyleColor ( const QColor & c)

Definition at line 2108 of file qquicktext.cpp.

References d, emit, QQuickItem::isComponentComplete(), QRgb, rgb, styleColorChanged(), QQuickItem::update(), and QQuickTextPrivate::UpdatePaintNode.

+ Here is the call graph for this function:

◆ setText()

void QQuickText::setText ( const QString & n)

Definition at line 1938 of file qquicktext.cpp.

References AutoText, d, emit, QQuickItem::isComponentComplete(), QQuickItem::ItemObservesViewport, QQuickTextPrivate::largeTextSizeThreshold, MarkdownText, Qt::mightBeRichText(), qDeleteAll(), RichText, QQuickItem::setAcceptHoverEvents(), QQuickItem::setFlag(), StyledText, and textChanged().

+ Here is the call graph for this function:

◆ setTextFormat()

void QQuickText::setTextFormat ( TextFormat format)

Definition at line 2423 of file qquicktext.cpp.

References AutoText, d, emit, QQuickItem::isComponentComplete(), Qt::LeftButton, MarkdownText, Qt::mightBeRichText(), Qt::NoButton, RichText, QQuickItem::setAcceptedMouseButtons(), QQuickItem::setAcceptHoverEvents(), StyledText, and textFormatChanged().

+ Here is the call graph for this function:

◆ setTopPadding()

void QQuickText::setTopPadding ( qreal padding)

Definition at line 3432 of file qquicktext.cpp.

References d, and padding.

◆ setVAlign()

void QQuickText::setVAlign ( VAlignment align)

Definition at line 2234 of file qquicktext.cpp.

References d, emit, QQuickItem::isComponentComplete(), and verticalAlignmentChanged().

Referenced by QQuickCheckLabel::QQuickCheckLabel().

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

◆ setWrapMode()

void QQuickText::setWrapMode ( WrapMode w)

Definition at line 2272 of file qquicktext.cpp.

References d, emit, and wrapModeChanged().

+ Here is the call graph for this function:

◆ style()

QQuickText::TextStyle QQuickText::style ( ) const

\qmlproperty enumeration QtQuick::Text::style

Set an additional text style.

Supported text styles are:

\value Text.Normal - the default \value Text.Outline \value Text.Raised \value Text.Sunken

\qml Row { Text { font.pointSize: 24; text: "Normal" } Text { font.pointSize: 24; text: "Raised"; style: Text.Raised; styleColor: "#AAAAAA" } Text { font.pointSize: 24; text: "Outline";style: Text.Outline; styleColor: "red" } Text { font.pointSize: 24; text: "Sunken"; style: Text.Sunken; styleColor: "#AAAAAA" } } \endqml

Definition at line 2067 of file qquicktext.cpp.

References d.

◆ styleChanged

void QQuickText::styleChanged ( QQuickText::TextStyle style)
signal

Referenced by setStyle().

+ Here is the caller graph for this function:

◆ styleColor()

QColor QQuickText::styleColor ( ) const

\qmlproperty color QtQuick::Text::styleColor

Defines the secondary color used by text styles.

styleColor is used as the outline color for outlined text, and as the shadow color for raised or sunken text. If no style has been set, it is not used at all.

\qml Text { font.pointSize: 18; text: "hello"; style: Text.Raised; styleColor: "gray" } \endqml

See also
style

Definition at line 2102 of file qquicktext.cpp.

References d, and QColor::fromRgba().

+ Here is the call graph for this function:

◆ styleColorChanged

void QQuickText::styleColorChanged ( )
signal

Referenced by setStyleColor().

+ Here is the caller graph for this function:

◆ text()

QString QQuickText::text ( ) const

\qmlproperty string QtQuick::Text::text

The text to display. Text supports both plain and rich text strings.

The item will try to automatically determine whether the text should be treated as styled text. This determination is made using Qt::mightBeRichText(). However, detection of Markdown is not automatic.

See also
textFormat

Definition at line 1932 of file qquicktext.cpp.

References d.

◆ textChanged

void QQuickText::textChanged ( const QString & text)
signal

Referenced by QQuickLabel::QQuickLabel(), and setText().

+ Here is the caller graph for this function:

◆ textFormat()

QQuickText::TextFormat QQuickText::textFormat ( ) const

\qmlproperty enumeration QtQuick::Text::textFormat

The way the \l text property should be displayed.

Supported text formats are:

\value Text.AutoText (default) detected via the Qt::mightBeRichText() heuristic \value Text.PlainText all styling tags are treated as plain text \value Text.StyledText optimized basic rich text as in HTML 3.2 \value Text.RichText \l {Supported HTML Subset} {a subset of HTML 4} \value Text.MarkdownText \l {https://commonmark.org/help/}{CommonMark} plus the \l {https://guides.github.com/features/mastering-markdown/}{GitHub} extensions for tables and task lists (since 5.14)

If the text format is Text.AutoText, the Text item will automatically determine whether the text should be treated as styled text. This determination is made using Qt::mightBeRichText(), which can detect the presence of an HTML tag on the first line of text, but cannot distinguish Markdown from plain text.

Text.StyledText is an optimized format supporting some basic text styling markup, in the style of HTML 3.2:

<b></b> - bold
<del></del> - strike out (removed content)
<s></s> - strike out (no longer accurate or no longer relevant content)
<strong></strong> - bold
<i></i> - italic
<br> - new line
<p> - paragraph
<u> - underlined text
<font color="color_name" size="1-7"></font>
<h1> to <h6> - headers
<a href=""> - anchor
<img src="" align="top,middle,bottom" width="" height=""> - inline images
<ol type="">, <ul type=""> and <li> - ordered and unordered lists
<pre></pre> - preformatted
QString text
GLboolean GLboolean GLboolean b
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum src
GLint GLsizei width
GLuint color
[2]
GLenum type
GLdouble s
[6]
Definition qopenglext.h:235
GLint void * img
Definition qopenglext.h:233
GLfloat GLfloat p
[1]
GLuint * lists
static const struct QTextHtmlEntity entities[]
QList< QImage > images
[6]
QTextStream out(stdout)
[7]
QSharedPointer< int > strong

Text.StyledText parser is strict, requiring tags to be correctly nested.

\table \row

  • Column {
    Text {
    font.pointSize: 24
    text: "<b>Hello</b> <i>World!</i>"
    }
    Text {
    font.pointSize: 24
    textFormat: Text.RichText
    text: "<b>Hello</b> <i>World!</i>"
    }
    Text {
    font.pointSize: 24
    textFormat: Text.PlainText
    text: "<b>Hello</b> <i>World!</i>"
    }
    Text {
    font.pointSize: 24
    textFormat: Text.MarkdownText
    text: "**Hello** *World!*"
    }
    }
  • \endtable

Text.RichText supports a larger subset of HTML 4, as described on the \l {Supported HTML Subset} page. You should prefer using Text.PlainText, Text.StyledText or Text.MarkdownText instead, as they offer better performance.

Note
With Text.MarkdownText, and with the supported subset of HTML, some decorative elements are not rendered as they would be in a web browser: \list
  • code blocks use the \l {QFontDatabase::FixedFont}{default monospace font} but without a surrounding highlight box
  • block quotes are indented, but there is no vertical line alongside the quote \endlist

Definition at line 2417 of file qquicktext.cpp.

References d.

◆ textFormatChanged

void QQuickText::textFormatChanged ( QQuickText::TextFormat textFormat)
signal

Referenced by setTextFormat().

+ Here is the caller graph for this function:

◆ topPadding()

qreal QQuickText::topPadding ( ) const

Definition at line 3424 of file qquicktext.cpp.

References d.

◆ truncated()

bool QQuickText::truncated ( ) const

\qmlproperty bool QtQuick::Text::truncated

Returns true if the text has been truncated due to \l maximumLineCount or \l elide.

This property is not supported for rich text.

See also
maximumLineCount, elide

Definition at line 2309 of file qquicktext.cpp.

References d.

◆ truncatedChanged

void QQuickText::truncatedChanged ( )
signal

Referenced by resetMaximumLineCount().

+ Here is the caller graph for this function:

◆ updatePaintNode()

QSGNode * QQuickText::updatePaintNode ( QSGNode * oldNode,
UpdatePaintNodeData * updatePaintNodeData )
overrideprotectedvirtual

Called on the render thread when it is time to sync the state of the item with the scene graph.

The function is called as a result of QQuickItem::update(), if the user has set the QQuickItem::ItemHasContents flag on the item.

The function should return the root of the scene graph subtree for this item. Most implementations will return a single QSGGeometryNode containing the visual representation of this item. oldNode is the node that was returned the last time the function was called. updatePaintNodeData provides a pointer to the QSGTransformNode associated with this QQuickItem.

QSGNode *MyItem::updatePaintNode(QSGNode *node, UpdatePaintNodeData *)
{
QSGSimpleRectNode *n = static_cast<QSGSimpleRectNode *>(node);
if (!n) {
n->setColor(Qt::red);
}
n->setRect(boundingRect());
return n;
}
QRectF boundingRect() const override
Returns the extents of the text after layout.
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
The QSGSimpleRectNode class is a convenience class for drawing solid filled rectangles using scenegra...
@ red
Definition qnamespace.h:35
GLfloat n

The main thread is blocked while this function is executed so it is safe to read values from the QQuickItem instance and other objects in the main thread.

If no call to QQuickItem::updatePaintNode() result in actual scene graph changes, like QSGNode::markDirty() or adding and removing nodes, then the underlying implementation may decide to not render the scene again as the visual outcome is identical.

Warning
It is crucial that graphics operations and interaction with the scene graph happens exclusively on the render thread, primarily during the QQuickItem::updatePaintNode() call. The best rule of thumb is to only use classes with the "QSG" prefix inside the QQuickItem::updatePaintNode() function.
This function is called on the render thread. This means any QObjects or thread local storage that is created will have affinity to the render thread, so apply caution when doing anything other than rendering in this function. Similarly for signals, these will be emitted on the render thread and will thus often be delivered via queued connections.
Note
All classes with QSG prefix should be used solely on the scene graph's rendering thread. See \l {Scene Graph and Rendering} for more information.
See also
QSGMaterial, QSGGeometryNode, QSGGeometry, QSGFlatColorMaterial, QSGTextureMaterial, QSGNode::markDirty(), {Graphics Resource Handling}

Reimplemented from QQuickItem.

Definition at line 2696 of file qquicktext.cpp.

References QSGInternalTextNode::addImage(), QSGTextNode::addTextDocument(), QSGTextNode::addTextLayout(), QQuickTextUtil::alignedX(), QQuickTextUtil::alignedY(), QSGInternalTextNode::clear(), clipRect(), d, effectiveHAlign(), QQuickItem::flags(), QColor::fromRgba(), QPixmap::height(), invalidateFontCaches(), QQuickItem::ItemObservesViewport, leftPadding, QSGTexture::Linear, QSGTexture::Nearest, pix, Q_UNUSED, QSGInternalTextNode::setColor(), QSGInternalTextNode::setFiltering(), QSGInternalTextNode::setLinkColor(), QSGTransformNode::setMatrix(), QSGInternalTextNode::setRenderType(), QSGInternalTextNode::setRenderTypeQuality(), QSGInternalTextNode::setStyleColor(), QSGInternalTextNode::setTextStyle(), QSGInternalTextNode::setViewport(), QQuickItem::smooth, testFlag(), topPadding, QQuickTextPrivate::UpdateNone, QQuickTextPrivate::UpdatePaintNode, and QPixmap::width().

+ Here is the call graph for this function:

◆ updatePolish()

void QQuickText::updatePolish ( )
overrideprotectedvirtual

This function should perform any layout as required for this item.

When polish() is called, the scene graph schedules a polish event for this item. When the scene graph is ready to render this item, it calls updatePolish() to do any item layout as required before it renders the next frame.

See also
ensurePolished()

Reimplemented from QQuickItem.

Definition at line 2770 of file qquicktext.cpp.

References QQuickItemPrivate::Clip, clipRect(), d, QFontInfo::family(), and invalidateFontCaches().

+ Here is the call graph for this function:

◆ vAlign()

QQuickText::VAlignment QQuickText::vAlign ( ) const

Definition at line 2228 of file qquicktext.cpp.

References d.

◆ verticalAlignmentChanged

void QQuickText::verticalAlignmentChanged ( QQuickText::VAlignment alignment)
signal

Referenced by setVAlign().

+ Here is the caller graph for this function:

◆ wrapMode()

QQuickText::WrapMode QQuickText::wrapMode ( ) const

\qmlproperty enumeration QtQuick::Text::wrapMode

Set this property to wrap the text to the Text item's width. The text will only wrap if an explicit width has been set. wrapMode can be one of:

\value Text.NoWrap (default) no wrapping will be performed. If the text contains insufficient newlines, then \l contentWidth will exceed a set width. \value Text.WordWrap wrapping is done on word boundaries only. If a word is too long, \l contentWidth will exceed a set width. \value Text.WrapAnywhere wrapping is done at any point on a line, even if it occurs in the middle of a word. \value Text.Wrap if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.

Definition at line 2266 of file qquicktext.cpp.

References d.

◆ wrapModeChanged

void QQuickText::wrapModeChanged ( )
signal

Referenced by setWrapMode().

+ Here is the caller graph for this function:

Member Data Documentation

◆ const

qreal y QQuickText::const

Definition at line 219 of file qquicktext_p.h.

Property Documentation

◆ advance

QSizeF QQuickText::advance
read

Definition at line 69 of file qquicktext_p.h.

◆ baseUrl

QUrl QQuickText::baseUrl
readwrite

Definition at line 54 of file qquicktext_p.h.

Referenced by setBaseUrl().

◆ bottomPadding

qreal QQuickText::bottomPadding
readwrite

Definition at line 66 of file qquicktext_p.h.

◆ color

QColor QQuickText::color
readwrite

Definition at line 34 of file qquicktext_p.h.

◆ contentHeight

qreal QQuickText::contentHeight
read

Definition at line 49 of file qquicktext_p.h.

◆ contentWidth

qreal QQuickText::contentWidth
read

Definition at line 48 of file qquicktext_p.h.

◆ effectiveHorizontalAlignment

HAlignment QQuickText::effectiveHorizontalAlignment
read

Definition at line 39 of file qquicktext_p.h.

◆ elide

TextElideMode QQuickText::elide
readwrite

Definition at line 47 of file qquicktext_p.h.

Referenced by geometryChange().

◆ font

QFont QQuickText::font
readwrite

Definition at line 33 of file qquicktext_p.h.

Referenced by QQuickLabel::font(), and setFont().

◆ fontInfo

QJSValue QQuickText::fontInfo
read

Definition at line 68 of file qquicktext_p.h.

◆ fontSizeMode

FontSizeMode QQuickText::fontSizeMode
readwrite

Definition at line 57 of file qquicktext_p.h.

◆ horizontalAlignment

HAlignment QQuickText::horizontalAlignment
readwrite

Definition at line 38 of file qquicktext_p.h.

◆ hoveredLink

QString QQuickText::hoveredLink
read

Definition at line 59 of file qquicktext_p.h.

◆ leftPadding

qreal QQuickText::leftPadding
readwrite

Definition at line 64 of file qquicktext_p.h.

Referenced by updatePaintNode().

◆ lineCount

int QQuickText::lineCount
read

Definition at line 42 of file qquicktext_p.h.

◆ lineHeight

qreal QQuickText::lineHeight
readwrite

Definition at line 52 of file qquicktext_p.h.

Referenced by setLineHeight().

◆ lineHeightMode

LineHeightMode QQuickText::lineHeightMode
readwrite

Definition at line 53 of file qquicktext_p.h.

◆ linkColor

QColor QQuickText::linkColor
readwrite

Definition at line 35 of file qquicktext_p.h.

◆ maximumLineCount

int QQuickText::maximumLineCount
readwrite

Definition at line 44 of file qquicktext_p.h.

◆ minimumPixelSize

int QQuickText::minimumPixelSize
readwrite

Definition at line 55 of file qquicktext_p.h.

◆ minimumPointSize

int QQuickText::minimumPointSize
readwrite

Definition at line 56 of file qquicktext_p.h.

◆ padding

qreal QQuickText::padding
readwrite

◆ paintedHeight

qreal QQuickText::paintedHeight
read

Definition at line 51 of file qquicktext_p.h.

◆ paintedWidth

qreal QQuickText::paintedWidth
read

Definition at line 50 of file qquicktext_p.h.

◆ renderType

RenderType QQuickText::renderType
readwrite

Definition at line 58 of file qquicktext_p.h.

Referenced by setRenderType().

◆ renderTypeQuality

int QQuickText::renderTypeQuality
readwrite

Definition at line 60 of file qquicktext_p.h.

Referenced by setRenderTypeQuality().

◆ rightPadding

qreal QQuickText::rightPadding
readwrite

Definition at line 65 of file qquicktext_p.h.

◆ style

TextStyle QQuickText::style
readwrite

Definition at line 36 of file qquicktext_p.h.

Referenced by setStyle().

◆ styleColor

QColor QQuickText::styleColor
readwrite

Definition at line 37 of file qquicktext_p.h.

◆ text

QString QQuickText::text
readwrite

Definition at line 32 of file qquicktext_p.h.

Referenced by QQuickMaterialPlaceholderText::componentComplete().

◆ textFormat

TextFormat QQuickText::textFormat
readwrite

Definition at line 46 of file qquicktext_p.h.

◆ topPadding

qreal QQuickText::topPadding
readwrite

Definition at line 63 of file qquicktext_p.h.

Referenced by updatePaintNode().

◆ truncated

bool QQuickText::truncated
read

Definition at line 43 of file qquicktext_p.h.

◆ verticalAlignment

VAlignment QQuickText::verticalAlignment
readwrite

Definition at line 40 of file qquicktext_p.h.

◆ wrapMode

WrapMode QQuickText::wrapMode
readwrite

Definition at line 41 of file qquicktext_p.h.


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