Details
-
Bug
-
Resolution: Duplicate
-
P4: Low
-
None
-
5.15.4, 6.2.0
Description
When tried with the following code, it is expected that text width is same as TextMetrix width
Text { id: txt text: qsTr("NOT FOR PATIENT USE") height: 14 font.pixelSize: 11 font.family: "Courier" // "Arial" color: "#2B2D2E" font.letterSpacing: 0 } TextMetrics { id: textMetrics font: txt.font text: txt.text } Component.onCompleted: { console.log("textMetrics.width: ",textMetrics.width ) console.log("txt.implicitWidth: ",txt.implicitWidth ) }
The output is gives:
For "Arial" font: qml: textMetrics.width: 109 qml: txt.implicitWidth: 125 For "Courier" font: qml: textMetrics.width: 151 qml: txt.implicitWidth: 152
Attachments
Issue Links
- duplicates
-
QTBUG-85936 TextMetrics.width does not always give a correct width for the given text and is sometimes too short depending on the font used
- Closed
For Gerrit Dashboard: QTBUG-94023 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
376365,13 | Fix inconsistencies between advanceWidth and bounding rects | dev | qt/qtbase | Status: MERGED | +2 | 0 |
376616,3 | Add QFontMetricsF methods taking text options into account | dev | qt/qtbase | Status: MERGED | +2 | 0 |
376617,5 | Calculate text metrics using design metrics | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |