TextMetrics QML Type
Provides metrics for a given font and text More...
Import Statement: | import QtQuick 2.4 |
Since: | Qt 5.4 |
Properties
- advanceWidth : real
- boundingRect : rect
- elide : enumeration
- elideWidth : real
- font : font
- height : real
- text : string
- tightBoundingRect : rect
- width : real
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.
TextMetrics { id: textMetrics font.family: "Arial" elide: Text.ElideMiddle elideWidth: 100 text: "Hello World" } MyItem { text: textMetrics.elidedText }
See also QFontMetricsF and FontMetrics.
Property Documentation
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 QFontMetricsF::width().
boundingRect : rect |
This property holds the bounding rectangle of the characters in the string specified by text.
See also QFontMetricsF::boundingRect() and tightBoundingRect.
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 and elidedText.
This property holds the largest width the text can have (in pixels) before eliding will occur.
See also elide and elidedText.
font : font |
This property holds the font used for the metrics calculations.
This property holds the height of the bounding rectangle of the characters in the string specified by text. It is equivalent to:
textMetrics.boundingRect.height
See also boundingRect.
tightBoundingRect : rect |
This property holds a tight bounding rectangle around the characters in the string specified by text.
See also QFontMetricsF::tightBoundingRect() and boundingRect.
This property holds the width of the bounding rectangle of the characters in the string specified by text. It is equivalent to:
textMetrics.boundingRect.width
See also boundingRect.
© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.