TextMetrics QML Type

주어진 글꼴 및 텍스트에 대한 메트릭을 제공합니다. 더 보기...

Import Statement: import QtQuick

속성

상세 설명

TextMetrics는 특정 글꼴에 대해 주어진 텍스트 문자열의 다양한 속성을 계산합니다.

인수를 받는 QFontMetricsF 의 함수에 대한 선언적 API를 제공합니다.

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

MyItem {
    text: textMetrics.elidedText
}

QFontMetricsFFontMetrics도 참조하세요 .

속성 문서

advanceWidth : real [read-only]

이 속성은 text 에 있는 문자의 픽셀 단위 전진을 보유합니다. 이것은 문자열의 위치에서 다음 문자열이 그려져야 하는 위치까지의 거리입니다.

QFontMetricsF::horizontalAdvance()도 참조하세요 .


boundingRect : rect [read-only]

이 속성은 text 에 지정된 문자열에 있는 문자의 경계 사각형을 보유합니다.

QFontMetricsF::boundingRect() 및 tightBoundingRect도 참조하십시오 .


elide : enumeration

이 속성은 텍스트의 엘리드 모드를 보유합니다. 이 속성은 문자열이 지워지는 위치를 결정합니다. 가능한 값은 다음과 같습니다:

Constant설명
Qt::ElideNone엘리이드 없음, 기본값입니다.
Qt::ElideLeft예 "...World"
Qt::ElideMiddle예: "..: "He...ld"
Qt::ElideRight예 "Hello..."

elideWidthQFontMetrics::elidedText참조하세요 .


elideWidth : real

이 속성은 엘리딩이 발생하기 전에 텍스트가 가질 수 있는 최대 너비(픽셀 단위)를 보유합니다.

elideQFontMetrics::elidedText도 참조하십시오 .


elidedText : string [read-only]

text 문자열이 elideWidth 보다 넓은 경우 이 속성은 문자열의 엘리드 버전(즉, "..."이 포함된 문자열)을 보유합니다. 텍스트가 elideWidth 보다 넓지 않거나 elideQt::ElideNone 로 설정된 경우 이 속성은 원래 문자열과 동일합니다.

QFontMetricsF::elidedText()도 참조하세요 .


font : font

이 속성은 지표 계산에 사용되는 글꼴을 보유합니다.


height : real [read-only]

이 속성은 text 에 지정된 문자열에 있는 문자의 경계 사각형의 높이를 보유합니다. 와 같습니다:

textMetrics.boundingRect.height

boundingRect참조하세요 .


renderType : enumeration [since 6.3]

이 컴포넌트의 기본 렌더링 유형을 재정의합니다.

지원되는 렌더링 유형은 다음과 같습니다:

Constant설명
TextEdit.QtRendering각 글리프에 대해 확장 가능한 거리 필드를 사용하여 텍스트가 렌더링됩니다.
TextEdit.NativeRendering텍스트는 플랫폼별 기술을 사용하여 렌더링됩니다.

이는 텍스트를 그릴 때 의도한 renderType 와 일치해야 합니다.

이 프로퍼티는 Qt 6.3에 도입되었습니다.

Text.renderType참조하십시오 .


text : string

이 프로퍼티는 메트릭 계산에 사용되는 텍스트를 보유합니다.


tightBoundingRect : rect [read-only]

이 프로퍼티는 text 에 지정된 문자열의 문자 주위에 단단한 경계 직사각형을 유지합니다.

QFontMetricsF::tightBoundingRect() 및 boundingRect도 참조하십시오 .


width : real [read-only]

이 속성은 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.