![]() |
Qt 6.x
The Qt SDK
|
#include <qquicktext_p.h>
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 |
![]() | |
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. | |
virtual QRectF | boundingRect () const |
Returns the extents of the item in its own coordinate system: a rectangle from {0, 0} to \l width() and \l height(). | |
virtual QRectF | clipRect () const |
Returns the rectangular area within this item that is currently visible in \l viewportItem(), if there is a viewport and the \l ItemObservesViewport flag is set; otherwise, the extents of this item in its own coordinate system: a rectangle from {0, 0} to \l width() and \l height(). | |
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. | |
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 | event (QEvent *event) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. | |
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. | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. | |
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::milliseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
void | killTimer (int id) |
Kills the timer with timer identifier, id. | |
template<typename T > | |
T | findChild (const QString &aName=QString(), 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 (const QString &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 > | |
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 () |
virtual void | classBegin ()=0 |
Invoked after class creation, but before any properties have been set. | |
virtual void | componentComplete ()=0 |
Invoked after the root component that caused this instantiation has completed construction. | |
virtual void | invalidate ()=0 |
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. | |
virtual void | itemChange (ItemChange, const ItemChangeData &) |
Called when change occurs for this item. | |
virtual void | geometryChange (const QRectF &newGeometry, const QRectF &oldGeometry) |
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. | |
void | componentComplete () override |
\reimp Derived classes should call the base class method before adding their own actions to perform at componentComplete. | |
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 | mousePressEvent (QMouseEvent *event) |
This event handler can be reimplemented in a subclass to receive mouse press 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 | mouseReleaseEvent (QMouseEvent *event) |
This event handler can be reimplemented in a subclass to receive mouse release 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 void | hoverEnterEvent (QHoverEvent *event) |
This event handler can be reimplemented in a subclass to receive hover-enter events for an item. | |
virtual void | hoverMoveEvent (QHoverEvent *event) |
This event handler can be reimplemented in a subclass to receive hover-move events for an item. | |
virtual void | hoverLeaveEvent (QHoverEvent *event) |
This event handler can be reimplemented in a subclass to receive hover-leave 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 QSGNode * | updatePaintNode (QSGNode *, UpdatePaintNodeData *) |
Called on the render thread when it is time to sync the state of the item with the scene graph. | |
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(). | |
virtual void | updatePolish () |
This function should perform any layout as required for this item. | |
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 |
FINALint | renderTypeQuality |
FINALqreal | padding |
FINALqreal | topPadding |
FINALqreal | leftPadding |
FINALqreal | rightPadding |
FINALqreal | bottomPadding |
FINALQJSValue | fontInfo |
FINALQSizeF | 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 | |
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 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 |
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 127 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 124 of file qquicktext_p.h.
Enumerator | |
---|---|
QtRendering | |
NativeRendering |
Definition at line 111 of file qquicktext_p.h.
Enumerator | |
---|---|
DefaultRenderTypeQuality | |
LowRenderTypeQuality | |
NormalRenderTypeQuality | |
HighRenderTypeQuality | |
VeryHighRenderTypeQuality |
Definition at line 116 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 \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, red text with a specific font and size can be defined like this:
\qml Text { text: "Hello World!" font.family: "Helvetica" font.pointSize: 24 color: "red" } \endqml
Rich text is defined using HTML-style markup:
\qml Text { text: "<b>Hello</b> <i>World!</i>" } \endqml
If height and width are not explicitly set, Text will attempt to determine how much room is needed and set it accordingly. Unless \l wrapMode is set, it will always prefer width to height (all text will be placed on a single line).
The \l elide property can alternatively be used to fit a single line of plain text to a set width.
Note that the \l{Supported HTML Subset} is limited. Also, if the text contains HTML img tags that load remote images, the text is reloaded.
Text provides read-only text. For editable text, see \l TextEdit.
Definition at line 1340 of file qquicktext.cpp.
References d.
|
override |
Definition at line 1354 of file qquicktext.cpp.
|
protected |
Definition at line 1347 of file qquicktext.cpp.
References d.
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 the right to the left.
Definition at line 3419 of file qquicktext.cpp.
References d.
QUrl QQuickText::baseUrl | ( | ) | const |
\qmlproperty url QtQuick::Text::baseUrl
This property specifies a base URL which 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 2358 of file qquicktext.cpp.
References context, d, and qmlContext().
|
signal |
qreal QQuickText::bottomPadding | ( | ) | const |
Definition at line 3311 of file qquicktext.cpp.
References d.
|
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 2408 of file qquicktext.cpp.
References QQuickTextUtil::alignedX(), QQuickTextUtil::alignedY(), d, effectiveHAlign(), Normal, and rect.
|
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 2434 of file qquicktext.cpp.
References QQuickItem::clipRect(), d, Normal, and rect.
Referenced by updatePolish().
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 1831 of file qquicktext.cpp.
References d, and QColor::fromRgba().
|
signal |
|
overridevirtual |
Reimplemented from QQuickItem.
Definition at line 2835 of file qquicktext.cpp.
References QQuickItem::componentComplete(), and d.
Referenced by QQuickMaterialPlaceholderText::componentComplete(), QQuickPlaceholderText::componentComplete(), and QQuickLabel::componentComplete().
qreal QQuickText::contentHeight | ( | ) | const |
\qmlproperty real QtQuick::Text::contentHeight
Returns the height of the text, including height past the height which is covered due to there being more text than fits in the set height.
Definition at line 2644 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 which is covered due to insufficient wrapping if WrapMode is set.
Definition at line 2632 of file qquicktext.cpp.
References d.
QQuickText::HAlignment QQuickText::effectiveHAlign | ( | ) | const |
Definition at line 2009 of file qquicktext.cpp.
References AlignLeft, AlignRight, and d.
Referenced by boundingRect(), geometryChange(), and updatePaintNode().
|
signal |
Referenced by QQuickPlaceholderText::componentComplete().
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 2317 of file qquicktext.cpp.
References d.
|
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, e.g. "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 e.g. 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 e.g. 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.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 intepretations. 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 we would like to also disable kerning for the font, we 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, egardless of whether the \l font.kerning property is set to false. Similarly, if it is set to 0, then it will always be disabled.Definition at line 1689 of file qquicktext.cpp.
References d.
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 string QtQuick::Text::fontInfo.pixelSize
The pixel size of the font info that has been resolved for the current font and fontSizeMode.
Definition at line 3386 of file qquicktext.cpp.
References d, engine, QJSEngine::newObject(), qjsEngine(), qmlWarning(), QStringLiteral, and QJSValue::setProperty().
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 2744 of file qquicktext.cpp.
References d.
|
signal |
|
overrideprotectedvirtual |
Reimplemented from QQuickItem.
Definition at line 2445 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().
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 1986 of file qquicktext.cpp.
References d.
|
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 2997 of file qquicktext.cpp.
References d, QQuickItem::mapToScene(), pos, QCursor::pos(), and QQuickItem::window().
|
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 3031 of file qquicktext.cpp.
References d.
|
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 3043 of file qquicktext.cpp.
References d.
|
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 3037 of file qquicktext.cpp.
References d.
|
overridevirtual |
|
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 3194 of file qquicktext.cpp.
References d, QTextLayout::engine(), QTextBlock::isValid(), QTextBlock::layout(), QTextBlock::next(), and QTextEngine::resetFontEngineCache().
Referenced by updatePaintNode(), and updatePolish().
|
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 1727 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().
qreal QQuickText::leftPadding | ( | ) | const |
Definition at line 3271 of file qquicktext.cpp.
References d.
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 2132 of file qquicktext.cpp.
References d.
|
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 2659 of file qquicktext.cpp.
References d.
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 2689 of file qquicktext.cpp.
References d.
|
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 1862 of file qquicktext.cpp.
References d, and QColor::fromRgba().
|
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 2165 of file qquicktext.cpp.
References d.
|
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 2773 of file qquicktext.cpp.
References d.
|
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 2803 of file qquicktext.cpp.
References d.
|
signal |
|
overrideprotectedvirtual |
Reimplemented from QQuickItem.
Definition at line 2896 of file qquicktext.cpp.
References d, QString::isEmpty(), and QQuickItem::mousePressEvent().
|
overrideprotectedvirtual |
Reimplemented from QQuickItem.
Definition at line 2918 of file qquicktext.cpp.
References d, emit, QString::isEmpty(), linkActivated(), and QQuickItem::mouseReleaseEvent().
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 3221 of file qquicktext.cpp.
References d.
|
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.
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.
The default rendering type is determined by \l QQuickWindow::textRenderType().
Definition at line 3127 of file qquicktext.cpp.
References d.
|
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 3089 of file qquicktext.cpp.
References d.
void QQuickText::resetBaseUrl | ( | ) |
Definition at line 2393 of file qquicktext.cpp.
References context, qmlContext(), and setBaseUrl().
void QQuickText::resetBottomPadding | ( | ) |
Definition at line 3325 of file qquicktext.cpp.
References d.
void QQuickText::resetHAlign | ( | ) |
Definition at line 2001 of file qquicktext.cpp.
References d, and QQuickItem::isComponentComplete().
void QQuickText::resetLeftPadding | ( | ) |
Definition at line 3285 of file qquicktext.cpp.
References d.
void QQuickText::resetMaximumLineCount | ( | ) |
Definition at line 2184 of file qquicktext.cpp.
References d, emit, setMaximumLineCount(), and truncatedChanged().
void QQuickText::resetPadding | ( | ) |
Definition at line 3246 of file qquicktext.cpp.
References setPadding().
void QQuickText::resetRightPadding | ( | ) |
Definition at line 3305 of file qquicktext.cpp.
References d.
void QQuickText::resetTopPadding | ( | ) |
Definition at line 3265 of file qquicktext.cpp.
References d.
int QQuickText::resourcesLoading | ( | ) | const |
Returns the number of resources (images) that are being loaded asynchronously.
Definition at line 2826 of file qquicktext.cpp.
References d.
qreal QQuickText::rightPadding | ( | ) | const |
Definition at line 3291 of file qquicktext.cpp.
References d.
Definition at line 2371 of file qquicktext.cpp.
References baseUrl, baseUrlChanged(), d, emit, qDeleteAll(), and url.
Referenced by resetBaseUrl().
Definition at line 3319 of file qquicktext.cpp.
Definition at line 1837 of file qquicktext.cpp.
References colorChanged(), d, emit, QQuickItem::isComponentComplete(), QRgb, rgb, QQuickItem::update(), and QQuickTextPrivate::UpdatePaintNode.
void QQuickText::setElideMode | ( | QQuickText::TextElideMode | mode | ) |
Definition at line 2323 of file qquicktext.cpp.
References d, elideModeChanged(), and emit.
Referenced by QQuickCheckLabel::QQuickCheckLabel().
Definition at line 1695 of file qquicktext.cpp.
References QQuickItem::antialiasing, d, emit, font, fontChanged(), QFont::NoAntialias, and qRound().
void QQuickText::setFontSizeMode | ( | FontSizeMode | mode | ) |
Definition at line 2750 of file qquicktext.cpp.
References d, emit, fontSizeModeChanged(), and QQuickItem::polish().
void QQuickText::setHAlign | ( | HAlignment | align | ) |
Definition at line 1992 of file qquicktext.cpp.
References d, and QQuickItem::isComponentComplete().
Referenced by QQuickCheckLabel::QQuickCheckLabel().
Definition at line 3279 of file qquicktext.cpp.
Definition at line 2665 of file qquicktext.cpp.
References d, emit, lineHeight, and lineHeightChanged().
void QQuickText::setLineHeightMode | ( | LineHeightMode | mode | ) |
Definition at line 2695 of file qquicktext.cpp.
References d, emit, and lineHeightModeChanged().
Definition at line 1868 of file qquicktext.cpp.
References d, emit, QQuickItem::isComponentComplete(), linkColorChanged(), QRgb, rgb, QQuickItem::update(), and QQuickTextPrivate::UpdatePaintNode.
void QQuickText::setMaximumLineCount | ( | int | lines | ) |
Definition at line 2171 of file qquicktext.cpp.
References d, emit, false, and maximumLineCountChanged().
Referenced by resetMaximumLineCount().
void QQuickText::setMinimumPixelSize | ( | int | size | ) |
Definition at line 2779 of file qquicktext.cpp.
References d, emit, FixedSize, QQuickItem::heightValid(), minimumPixelSizeChanged(), QQuickItem::polish(), QQuickItem::size(), and QQuickItem::widthValid().
void QQuickText::setMinimumPointSize | ( | int | size | ) |
Definition at line 2809 of file qquicktext.cpp.
References d, emit, FixedSize, QQuickItem::heightValid(), minimumPointSizeChanged(), QQuickItem::polish(), QQuickItem::size(), and QQuickItem::widthValid().
Definition at line 3227 of file qquicktext.cpp.
References d, emit, padding, and qFuzzyCompare().
Referenced by resetPadding().
void QQuickText::setRenderType | ( | QQuickText::RenderType | renderType | ) |
Definition at line 3133 of file qquicktext.cpp.
References d, emit, QQuickItem::isComponentComplete(), renderType, and renderTypeChanged().
void QQuickText::setRenderTypeQuality | ( | int | renderTypeQuality | ) |
Definition at line 3095 of file qquicktext.cpp.
References d, emit, QQuickItem::isComponentComplete(), renderTypeQuality, QQuickItem::update(), and QQuickTextPrivate::UpdatePaintNode.
Definition at line 3299 of file qquicktext.cpp.
void QQuickText::setStyle | ( | QQuickText::TextStyle | style | ) |
Definition at line 1912 of file qquicktext.cpp.
References d, emit, QQuickItem::isComponentComplete(), style, styleChanged(), QQuickItem::update(), and QQuickTextPrivate::UpdatePaintNode.
Definition at line 1947 of file qquicktext.cpp.
References d, emit, QQuickItem::isComponentComplete(), QRgb, rgb, styleColorChanged(), QQuickItem::update(), and QQuickTextPrivate::UpdatePaintNode.
Definition at line 1777 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().
void QQuickText::setTextFormat | ( | TextFormat | format | ) |
Definition at line 2263 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().
Definition at line 3259 of file qquicktext.cpp.
void QQuickText::setVAlign | ( | VAlignment | align | ) |
Definition at line 2073 of file qquicktext.cpp.
References d, emit, QQuickItem::isComponentComplete(), and verticalAlignmentChanged().
Referenced by QQuickCheckLabel::QQuickCheckLabel().
Definition at line 2111 of file qquicktext.cpp.
References d, emit, and wrapModeChanged().
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 1906 of file qquicktext.cpp.
References d.
|
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 1941 of file qquicktext.cpp.
References d, and QColor::fromRgba().
|
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 1771 of file qquicktext.cpp.
References d.
Referenced by QQuickLabel::QQuickLabel(), and setText().
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 2257 of file qquicktext.cpp.
References d.
|
signal |
qreal QQuickText::topPadding | ( | ) | const |
Definition at line 3251 of file qquicktext.cpp.
References d.
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 2148 of file qquicktext.cpp.
References d.
|
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 2534 of file qquicktext.cpp.
References QQuickTextNode::addImage(), QQuickTextNode::addTextDocument(), QQuickTextNode::addTextLayout(), QQuickTextUtil::alignedX(), QQuickTextUtil::alignedY(), d, QQuickTextNode::deleteContent(), effectiveHAlign(), QColor::fromRgba(), QPixmap::height(), invalidateFontCaches(), leftPadding, linkColor, NativeRendering, pix, Q_UNUSED, QSGTransformNode::setMatrix(), QQuickTextNode::setRenderTypeQuality(), QQuickTextNode::setUseNativeRenderer(), styleColor, topPadding, QQuickTextPrivate::UpdateNone, QQuickTextPrivate::UpdatePaintNode, and QPixmap::width().
|
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 2605 of file qquicktext.cpp.
References QQuickItemPrivate::Clip, clipRect(), d, QFontInfo::family(), and invalidateFontCaches().
QQuickText::VAlignment QQuickText::vAlign | ( | ) | const |
Definition at line 2067 of file qquicktext.cpp.
References d.
|
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 2105 of file qquicktext.cpp.
References d.
|
signal |
Definition at line 218 of file qquicktext_p.h.
|
read |
Definition at line 68 of file qquicktext_p.h.
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
Referenced by setBaseUrl().
|
readwrite |
Definition at line 65 of file qquicktext_p.h.
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
|
read |
Definition at line 355 of file qquicktext_p.h.
|
read |
Definition at line 355 of file qquicktext_p.h.
|
read |
Definition at line 355 of file qquicktext_p.h.
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
Referenced by geometryChange().
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
Referenced by QQuickLabel::font(), and setFont().
|
read |
Definition at line 66 of file qquicktext_p.h.
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
|
read |
Definition at line 355 of file qquicktext_p.h.
|
readwrite |
Definition at line 63 of file qquicktext_p.h.
Referenced by updatePaintNode().
|
read |
Definition at line 355 of file qquicktext_p.h.
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
Referenced by setLineHeight().
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
Referenced by updatePaintNode().
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
|
readwrite |
Definition at line 60 of file qquicktext_p.h.
Referenced by setBottomPadding(), setLeftPadding(), setPadding(), setRightPadding(), and setTopPadding().
|
read |
Definition at line 355 of file qquicktext_p.h.
|
read |
Definition at line 355 of file qquicktext_p.h.
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
Referenced by setRenderType().
|
readwrite |
Definition at line 59 of file qquicktext_p.h.
Referenced by setRenderTypeQuality().
|
readwrite |
Definition at line 64 of file qquicktext_p.h.
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
Referenced by setStyle().
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
Referenced by updatePaintNode().
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
Referenced by QQuickMaterialPlaceholderText::componentComplete().
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
|
readwrite |
Definition at line 62 of file qquicktext_p.h.
Referenced by updatePaintNode().
|
read |
Definition at line 355 of file qquicktext_p.h.
Referenced by QQmlDebugTranslationServicePrivate::sendTranslationIssues().
|
readwrite |
Definition at line 355 of file qquicktext_p.h.
|
readwrite |
Definition at line 355 of file qquicktext_p.h.