IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

TextMetrics QML Type

Provides metrics for a given font and text.

This type was introduced in Qt 5.4.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

TextMetrics QML Type

  • Import Statement: import QtQuick

  • Since:: Qt 5.4

  • Group: TextMetrics is part of qtquick-text-utility

Detailed Description

TextMetrics calculates various properties of a given string of text for a particular font.

It provides a declarative API for the functions in QFontMetricsF which take arguments.

 
Sélectionnez
TextMetrics {
    id: textMetrics
    font.family: "Arial"
    elide: Text.ElideMiddle
    elideWidth: 100
    text: "Hello World"
}

MyItem {
    text: textMetrics.elidedText
}

See Also

Property Documentation

 

[read-only] advanceWidth : real

This property holds the advance in pixels of the characters in text. This is the distance from the position of the string to where the next string should be drawn.

See Also

[read-only] boundingRect : rect

This property holds the bounding rectangle of the characters in the string specified by text.

See Also

elide : enumeration

This property holds the elide mode of the text. This determines the position in which the string is elided. The possible values are:

  • Qt::ElideNone - No eliding; this is the default value.

  • Qt::ElideLeft - For example: "...World"

  • Qt::ElideMiddle - For example: "He...ld"

  • Qt::ElideRight - For example: "Hello..."

See Also

elideWidth : real

This property holds the largest width the text can have (in pixels) before eliding will occur.

See Also

[read-only] elidedText : string

This property holds an elided version of the string (i.e., a string with "..." in it) if the string text is wider than elideWidth. If the text is not wider than elideWidth, or elide is set to Qt::ElideNone, this property will be equal to the original string.

See Also

font : font

This property holds the font used for the metrics calculations.

[read-only] height : real

This property holds the height of the bounding rectangle of the characters in the string specified by text. It is equivalent to:

 
Sélectionnez
textMetrics.boundingRect.height
See Also

See also boundingRect

[since 6.3] renderType : enumeration

Override the default rendering type for this component.

Supported render types are:

  • Text.QtRendering

  • Text.NativeRendering

This should match the intended renderType where you draw the text.

This property was introduced in Qt 6.3.

See Also

See also Text.renderType

text : string

This property holds the text used for the metrics calculations.

[read-only] tightBoundingRect : rect

This property holds a tight bounding rectangle around the characters in the string specified by text.

See Also

[read-only] width : real

This property holds the width of the bounding rectangle of the characters in the string specified by text. It is equivalent to:

 
Sélectionnez
textMetrics.boundingRect.width
See Also

See also boundingRect

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+