![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include <qquicktext_p.h>
Public Member Functions | |
QQuickText (QQuickItem *parent=nullptr) | |
\qmltype Text \nativetype 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 |
![]() | |
QQuickItem (QQuickItem *parent=nullptr) | |
Constructs a QQuickItem with the given parent. | |
~QQuickItem () override | |
Destroys the QQuickItem. | |
QQuickWindow * | window () const |
Returns the window in which this item is rendered. | |
QQuickItem * | parentItem () 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< QQuickTransform > | transform () |
qreal | x () const |
qreal | y () const |
QPointF | position () const |
void | setX (qreal) |
void | setY (qreal) |
void | setPosition (const QPointF &) |
QBindable< qreal > | bindableX () |
QBindable< qreal > | bindableY () |
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< qreal > | bindableWidth () |
qreal | height () const |
void | setHeight (qreal) |
void | resetHeight () |
void | setImplicitHeight (qreal) |
qreal | implicitHeight () const |
QBindable< qreal > | bindableHeight () |
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. | |
QQuickItem * | viewportItem () 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. | |
QQuickItem * | scopedFocusItem () 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< QQuickItemGrabResult > | grabToImage (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) | |
QObject * | containmentMask () 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 QQuickItem * | childAt (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 QSGTextureProvider * | textureProvider () const |
Returns the texture provider for an item. | |
![]() | |
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< QString > | bindableObjectName () |
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). | |
QThread * | thread () 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> | |
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> | |
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 QObjectList & | children () 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< QByteArray > | dynamicPropertyNames () const |
QBindingStorage * | bindingStorage () |
const QBindingStorage * | bindingStorage () const |
QObject * | parent () 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 . | |
![]() | |
QQmlParserStatus () | |
virtual | ~QQmlParserStatus () |
Public Attributes | |
qreal y | const |
![]() | |
const QSize & | targetSize = 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 |
QSGNode * | updatePaintNode (QSGNode *, UpdatePaintNodeData *) override |
Called on the render thread when it is time to sync the state of the item with the scene graph. | |
void | 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 () |
![]() | |
QQuickImplicitSizeItem (QQuickImplicitSizeItemPrivate &dd, QQuickItem *parent) | |
![]() | |
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 bool | contextMenuEvent (QContextMenuEvent *event) |
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) | |
![]() | |
QObject * | sender () 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 |
![]() | |
qreal | implicitWidth |
qreal | implicitHeight |
![]() | |
QQuickItem * | parent |
\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< QQuickTransform > | transform |
\qmlproperty list<Transform> QtQuick::Item::transform | |
bool | smooth |
\qmlproperty bool QtQuick::Item::smooth | |
bool | antialiasing |
\qmlproperty bool QtQuick::Item::antialiasing | |
qreal | implicitWidth |
qreal | implicitHeight |
QObject * | containmentMask |
\qmlproperty QObject* QtQuick::Item::containmentMask | |
![]() | |
QString | objectName |
the name of this object | |
Additional Inherited Members | |
![]() | |
void | update () |
Schedules a call to updatePaintNode() for this item. | |
![]() | |
void | deleteLater () |
\threadsafe | |
![]() | |
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) |
![]() | |
QScopedPointer< QObjectData > | d_ptr |
![]() | |
template< class T > T | qobject_cast (const QObject *object) |
Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
\macro Q_CLASSINFO(Name, Value) | |
Definition at line 27 of file qquicktext_p.h.
Enumerator | |
---|---|
FixedSize | |
HorizontalFit | |
VerticalFit | |
Fit |
Definition at line 128 of file qquicktext_p.h.
Enumerator | |
---|---|
AlignLeft | |
AlignRight | |
AlignHCenter | |
AlignJustify |
Definition at line 77 of file qquicktext_p.h.
Enumerator | |
---|---|
ProportionalHeight | |
FixedHeight |
Definition at line 125 of file qquicktext_p.h.
Enumerator | |
---|---|
QtRendering | |
NativeRendering | |
CurveRendering |
Definition at line 111 of file qquicktext_p.h.
Enumerator | |
---|---|
DefaultRenderTypeQuality | |
LowRenderTypeQuality | |
NormalRenderTypeQuality | |
HighRenderTypeQuality | |
VeryHighRenderTypeQuality |
Definition at line 117 of file qquicktext_p.h.
Enumerator | |
---|---|
ElideLeft | |
ElideRight | |
ElideMiddle | |
ElideNone |
Definition at line 97 of file qquicktext_p.h.
Enumerator | |
---|---|
PlainText | |
RichText | |
MarkdownText | |
AutoText | |
StyledText |
Definition at line 91 of file qquicktext_p.h.
Enumerator | |
---|---|
Normal | |
Outline | |
Raised | |
Sunken |
Definition at line 86 of file qquicktext_p.h.
Enumerator | |
---|---|
AlignTop | |
AlignBottom | |
AlignVCenter |
Definition at line 82 of file qquicktext_p.h.
enum QQuickText::WrapMode |
Enumerator | |
---|---|
NoWrap | |
WordWrap | |
WrapAnywhere | |
WrapAtWordBoundaryOrAnywhere | |
Wrap |
Definition at line 103 of file qquicktext_p.h.
QQuickText::QQuickText | ( | QQuickItem * | parent = nullptr | ) |
\qmltype Text \nativetype 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 1467 of file qquicktext.cpp.
|
override |
Definition at line 1481 of file qquicktext.cpp.
|
protected |
Definition at line 1474 of file qquicktext.cpp.
QSizeF QQuickText::advance | ( | ) | const |
\qmlproperty size QtQuick::Text::advance
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 3676 of file qquicktext.cpp.
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 2600 of file qquicktext.cpp.
|
signal |
qreal QQuickText::bottomPadding | ( | ) | const |
Definition at line 3568 of file qquicktext.cpp.
|
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.
Reimplemented from QQuickItem.
Definition at line 2650 of file qquicktext.cpp.
|
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
.
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.Reimplemented from QQuickItem.
Definition at line 2676 of file qquicktext.cpp.
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 2074 of file qquicktext.cpp.
|
signal |
|
overridevirtual |
Reimplemented from QQuickItem.
Definition at line 3084 of file qquicktext.cpp.
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 2893 of file qquicktext.cpp.
|
signal |
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 2881 of file qquicktext.cpp.
QQuickText::HAlignment QQuickText::effectiveHAlign | ( | ) | const |
Definition at line 2252 of file qquicktext.cpp.
|
signal |
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 2559 of file qquicktext.cpp.
|
signal |
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
Text
element. \row Text
element. \row For example, this will move the first 5 lines of a Text item by 100 pixels to the right:
The following example will allow you to position an item at the end of the last line:
\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.
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
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
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.
\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
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
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.
\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
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.\qmlproperty bool QtQuick::Text::font.contextFontMerging \since 6.8
! [qml-font-context-font-merging] If the selected font does not contain a certain character, Qt automatically chooses a similar-looking fallback font that contains the character. By default this is done on a character-by-character basis.
This means that in certain uncommon cases, many different fonts may be used to represent one string of text even if it's in the same script. Setting contextFontMerging
to true will try finding the fallback font that matches the largest subset of the input string instead. This will be more expensive for strings where missing glyphs occur, but may give more consistent results. By default, contextFontMerging
is {false}.
\qmlproperty bool QtQuick::Text::font.preferTypoLineMetrics \since 6.8
! [qml-font-prefer-typo-line-metrics] For compatibility reasons, OpenType fonts contain two competing sets of the vertical line metrics that provide the \l{QFontMetricsF::ascent()}{ascent}, \l{QFontMetricsF::descent()}{descent} and \l{QFontMetricsF::leading()}{leading} of the font. These are often referred to as the \l{https://learn.microsoft.com/en-us/typography/opentype/spec/os2#uswinascent}{win} (Windows) metrics and the \l{https://learn.microsoft.com/en-us/typography/opentype/spec/os2#sta}{typo} (typographical) metrics. While the specification recommends using the typo
metrics for line spacing, many applications prefer the win
metrics unless the {USE_TYPO_METRICS} flag is set in the \l{https://learn.microsoft.com/en-us/typography/opentype/spec/os2#fsselection}{fsSelection} field of the font. For backwards-compatibility reasons, this is also the case for Qt applications. This is not an issue for fonts that set the
{USE_TYPO_METRICS} flag to indicate that the
{typo} metrics are valid, nor for fonts where the
{win} metrics and
{typo} metrics match up. However, for certain fonts the
{win} metrics may be larger than the preferable line spacing and the
{USE_TYPO_METRICS} flag may be unset by mistake. For such fonts, setting
{font.preferTypoLineMetrics} may give superior results.
By default, preferTypoLineMetrics
is {false}.
Definition at line 1916 of file qquicktext.cpp.
QJSValue QQuickText::fontInfo | ( | ) | const |
\qmlproperty string QtQuick::Text::fontInfo.family
The family name of the font that has been resolved for the current font and fontSizeMode.
\qmlproperty string QtQuick::Text::fontInfo.styleName
The style name of the font info that has been resolved for the current font and fontSizeMode.
\qmlproperty bool QtQuick::Text::fontInfo.bold
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
The weight of the font info that has been resolved for the current font and fontSizeMode.
\qmlproperty bool QtQuick::Text::fontInfo.italic
The italic state of the font info that has been resolved for the current font and fontSizeMode.
\qmlproperty real QtQuick::Text::fontInfo.pointSize
The pointSize of the font info that has been resolved for the current font and fontSizeMode.
\qmlproperty int QtQuick::Text::fontInfo.pixelSize
The pixel size of the font info that has been resolved for the current font and fontSizeMode.
Definition at line 3643 of file qquicktext.cpp.
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 2993 of file qquicktext.cpp.
|
signal |
|
overrideprotectedvirtual |
Reimplemented from QQuickItem.
Definition at line 2687 of file qquicktext.cpp.
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 2229 of file qquicktext.cpp.
|
signal |
QString QQuickText::hoveredLink | ( | ) | const |
\qmlsignal QtQuick::Text::linkHovered(string link)
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.
\qmlproperty string QtQuick::Text::hoveredLink
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.
Definition at line 3246 of file qquicktext.cpp.
|
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 3280 of file qquicktext.cpp.
|
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 3292 of file qquicktext.cpp.
|
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 3286 of file qquicktext.cpp.
|
overridevirtual |
Implements QQuickTextInterface.
Definition at line 3298 of file qquicktext.cpp.
|
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 3451 of file qquicktext.cpp.
|
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
typically at the end of your implementation, to ensure the \l windowChanged() signal will be emitted.
Reimplemented from QQuickItem.
Definition at line 1954 of file qquicktext.cpp.
qreal QQuickText::leftPadding | ( | ) | const |
Definition at line 3528 of file qquicktext.cpp.
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.
Definition at line 2375 of file qquicktext.cpp.
|
signal |
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 2908 of file qquicktext.cpp.
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 2938 of file qquicktext.cpp.
|
signal |
|
signal |
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 2105 of file qquicktext.cpp.
|
signal |
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.
Definition at line 2408 of file qquicktext.cpp.
|
signal |
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 3022 of file qquicktext.cpp.
|
signal |
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 3052 of file qquicktext.cpp.
|
signal |
|
overrideprotectedvirtual |
Reimplemented from QQuickItem.
Definition at line 3145 of file qquicktext.cpp.
|
overrideprotectedvirtual |
Reimplemented from QQuickItem.
Definition at line 3167 of file qquicktext.cpp.
qreal QQuickText::padding | ( | ) | const |
These properties hold the padding around the content. This space is reserved in addition to the contentWidth and contentHeight.
Definition at line 3478 of file qquicktext.cpp.
|
signal |
QQuickText::Q_REVISION | ( | 2 | , |
3 | ) |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
QQuickText::Q_REVISION | ( | 2 | , |
9 | ) |
|
signal |
|
signal |
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 3384 of file qquicktext.cpp.
|
signal |
int QQuickText::renderTypeQuality | ( | ) | const |
\qmlproperty int QtQuick::Text::renderTypeQuality
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 3338 of file qquicktext.cpp.
void QQuickText::resetBaseUrl | ( | ) |
Definition at line 2635 of file qquicktext.cpp.
void QQuickText::resetBottomPadding | ( | ) |
Definition at line 3582 of file qquicktext.cpp.
void QQuickText::resetHAlign | ( | ) |
Definition at line 2244 of file qquicktext.cpp.
void QQuickText::resetLeftPadding | ( | ) |
Definition at line 3542 of file qquicktext.cpp.
void QQuickText::resetMaximumLineCount | ( | ) |
Definition at line 2427 of file qquicktext.cpp.
void QQuickText::resetPadding | ( | ) |
Definition at line 3503 of file qquicktext.cpp.
void QQuickText::resetRightPadding | ( | ) |
Definition at line 3562 of file qquicktext.cpp.
void QQuickText::resetTopPadding | ( | ) |
Definition at line 3522 of file qquicktext.cpp.
int QQuickText::resourcesLoading | ( | ) | const |
Returns the number of resources (images) that are being loaded asynchronously.
Definition at line 3075 of file qquicktext.cpp.
qreal QQuickText::rightPadding | ( | ) | const |
Definition at line 3548 of file qquicktext.cpp.
Definition at line 2613 of file qquicktext.cpp.
Definition at line 3576 of file qquicktext.cpp.
Definition at line 2080 of file qquicktext.cpp.
void QQuickText::setElideMode | ( | QQuickText::TextElideMode | mode | ) |
Definition at line 2565 of file qquicktext.cpp.
Definition at line 1922 of file qquicktext.cpp.
void QQuickText::setFontSizeMode | ( | FontSizeMode | mode | ) |
Definition at line 2999 of file qquicktext.cpp.
void QQuickText::setHAlign | ( | HAlignment | align | ) |
Definition at line 2235 of file qquicktext.cpp.
Definition at line 3536 of file qquicktext.cpp.
Definition at line 2914 of file qquicktext.cpp.
void QQuickText::setLineHeightMode | ( | LineHeightMode | mode | ) |
Definition at line 2944 of file qquicktext.cpp.
Definition at line 2111 of file qquicktext.cpp.
void QQuickText::setMaximumLineCount | ( | int | lines | ) |
Definition at line 2414 of file qquicktext.cpp.
void QQuickText::setMinimumPixelSize | ( | int | size | ) |
Definition at line 3028 of file qquicktext.cpp.
void QQuickText::setMinimumPointSize | ( | int | size | ) |
Definition at line 3058 of file qquicktext.cpp.
Definition at line 3484 of file qquicktext.cpp.
void QQuickText::setRenderType | ( | QQuickText::RenderType | renderType | ) |
Definition at line 3390 of file qquicktext.cpp.
void QQuickText::setRenderTypeQuality | ( | int | renderTypeQuality | ) |
Definition at line 3344 of file qquicktext.cpp.
Definition at line 3556 of file qquicktext.cpp.
void QQuickText::setStyle | ( | QQuickText::TextStyle | style | ) |
Definition at line 2155 of file qquicktext.cpp.
Definition at line 2190 of file qquicktext.cpp.
Definition at line 2020 of file qquicktext.cpp.
void QQuickText::setTextFormat | ( | TextFormat | format | ) |
Definition at line 2505 of file qquicktext.cpp.
Definition at line 3516 of file qquicktext.cpp.
void QQuickText::setVAlign | ( | VAlignment | align | ) |
Definition at line 2316 of file qquicktext.cpp.
Definition at line 2354 of file qquicktext.cpp.
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 2149 of file qquicktext.cpp.
|
signal |
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
Definition at line 2184 of file qquicktext.cpp.
|
signal |
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.
Definition at line 2014 of file qquicktext.cpp.
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:
Text.StyledText
parser is strict, requiring tags to be correctly nested.
\table \row
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.
Text.MarkdownText
, and with the supported subset of HTML, some decorative elements are not rendered as they would be in a web browser: \list Definition at line 2499 of file qquicktext.cpp.
|
signal |
qreal QQuickText::topPadding | ( | ) | const |
Definition at line 3508 of file qquicktext.cpp.
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.
Definition at line 2391 of file qquicktext.cpp.
|
signal |
|
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.
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.
Reimplemented from QQuickItem.
Definition at line 2778 of file qquicktext.cpp.
|
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.
Reimplemented from QQuickItem.
Definition at line 2854 of file qquicktext.cpp.
QQuickText::VAlignment QQuickText::vAlign | ( | ) | const |
Definition at line 2310 of file qquicktext.cpp.
|
signal |
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 2348 of file qquicktext.cpp.
|
signal |
Definition at line 219 of file qquicktext_p.h.
|
read |
Definition at line 69 of file qquicktext_p.h.
|
readwrite |
Definition at line 54 of file qquicktext_p.h.
|
readwrite |
Definition at line 66 of file qquicktext_p.h.
|
readwrite |
Definition at line 34 of file qquicktext_p.h.
|
read |
Definition at line 49 of file qquicktext_p.h.
|
read |
Definition at line 48 of file qquicktext_p.h.
|
read |
Definition at line 39 of file qquicktext_p.h.
|
readwrite |
Definition at line 47 of file qquicktext_p.h.
|
readwrite |
Definition at line 33 of file qquicktext_p.h.
|
read |
Definition at line 68 of file qquicktext_p.h.
|
readwrite |
Definition at line 57 of file qquicktext_p.h.
|
readwrite |
Definition at line 38 of file qquicktext_p.h.
|
read |
Definition at line 59 of file qquicktext_p.h.
|
readwrite |
Definition at line 64 of file qquicktext_p.h.
|
read |
Definition at line 42 of file qquicktext_p.h.
|
readwrite |
Definition at line 52 of file qquicktext_p.h.
|
readwrite |
Definition at line 53 of file qquicktext_p.h.
|
readwrite |
Definition at line 35 of file qquicktext_p.h.
|
readwrite |
Definition at line 44 of file qquicktext_p.h.
|
readwrite |
Definition at line 55 of file qquicktext_p.h.
|
readwrite |
Definition at line 56 of file qquicktext_p.h.
|
readwrite |
Definition at line 62 of file qquicktext_p.h.
|
read |
Definition at line 51 of file qquicktext_p.h.
|
read |
Definition at line 50 of file qquicktext_p.h.
|
readwrite |
Definition at line 58 of file qquicktext_p.h.
|
readwrite |
Definition at line 60 of file qquicktext_p.h.
|
readwrite |
Definition at line 65 of file qquicktext_p.h.
|
readwrite |
Definition at line 36 of file qquicktext_p.h.
|
readwrite |
Definition at line 37 of file qquicktext_p.h.
|
readwrite |
Definition at line 32 of file qquicktext_p.h.
|
readwrite |
Definition at line 46 of file qquicktext_p.h.
|
readwrite |
Definition at line 63 of file qquicktext_p.h.
|
read |
Definition at line 43 of file qquicktext_p.h.
|
readwrite |
Definition at line 40 of file qquicktext_p.h.
|
readwrite |
Definition at line 41 of file qquicktext_p.h.