TextMetrics QML Type
与えられたフォントとテキストに対するメトリクスを提供します。詳細...
Import Statement: | import QtQuick |
プロパティ
- advanceWidth : real
- boundingRect : rect
- elide : enumeration
- elideWidth : real
- elidedText : string
- font : font
- height : real
- renderType : enumeration
(since 6.3)
- text : string
- tightBoundingRect : rect
- width : real
詳細説明
TextMetrics は、与えられたテキスト文字列の様々なプロパティを特定のフォントについて計算します。
引数をとるQFontMetricsF の関数に対する宣言的 API を提供します。
TextMetrics { id: textMetrics font.family: "Arial" elide: Text.ElideMiddle elideWidth: 100 text: "Hello World" } MyItem { text: textMetrics.elidedText }
QFontMetricsF およびFontMetricsも参照して ください。
プロパティ文書
advanceWidth : real |
こ のプ ロ パテ ィ は、text 内のキ ャ ラ ク タ の進み具合を ピ ク セル単位で保持 し ます。これは、文字列の位置から、次の文字列が描画されるべき位置までの距離です。
boundingRect : rect |
このプロパティは、text で指定された文字列の文字の外接矩形を保持します。
QFontMetricsF::boundingRect() およびtightBoundingRect も参照のこと 。
elide : enumeration |
このプロパティは、テキストのエライドモードを保持します。これは、文字列がエリッドされる位置を決定する。取り得る値は
定数 | 説明 |
---|---|
Qt::ElideNone | これはデフォルト値です。 |
Qt::ElideLeft | これはデフォルト値です:"...世界" |
Qt::ElideMiddle | 例えば"He...ld" |
Qt::ElideRight | 例えば「こんにちは |
elideWidth およびQFontMetrics::elidedTextも参照してください 。
elideWidth : real |
こ のプ ロ パテ ィ は、 テ キ ス ト がエ リ ーデ ィ ン グ さ れ る 前に持つ こ と がで き る 最大の幅を (ピ ク セル単位で) 保持 し ます。
elidedText : string |
このプロパティは、文字列text の幅がelideWidth よりも広い場合、その文字列のエライデッド・バージョン(つまり、"..." が含まれる文字列)を保持します。 テキスト幅がelideWidth よりも広くない場合、またはelide がQt::ElideNone
に設定されている場合、このプロパティは元の文字列と等しくなります。
QFontMetricsF::elidedText()も参照 。
font : font |
このプロパティは、メトリクスの計算に使用されるフォントを保持します。
height : real |
このプロパティは、text で指定された文字列内の文字の外接矩形の高さを保持します。と同等です:
textMetrics.boundingRect.height
boundingRectも参照してください 。
renderType : enumeration |
このコンポーネントのデフォルトのレンダリング・タイプをオーバーライドします。
サポートされているレンダリング・タイプは以下のとおりです:
定数 | 説明 |
---|---|
TextEdit.QtRendering | テキストは、各グリフに対してスケーラブルな距離フィールドを使用してレンダリングされます。 |
TextEdit.NativeRendering | テキストは、プラットフォーム固有の技法を使用してレンダリングされます。 |
これは、テキストを描画するrenderType
の意図と一致する必要があります。
このプロパティは Qt 6.3 で導入されました。
Text.renderTypeも参照してください 。
text : string |
このプロパティは、メトリクス計算に使用されるテキストを保持します。
tightBoundingRect : rect |
このプロパティは、text で指定された文字列内の文字を囲むタイトな境界矩形を保持します。
QFontMetricsF::tightBoundingRect ()およびboundingRectも参照 。
width : real |
このプロパティは、text で指定された文字列内の文字の外接矩形の幅を保持します。と等価です:
textMetrics.boundingRect.width
boundingRectも参照して ください。
© 2025 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.