Text height
QML and Qt Quick
4
Posts
2
Posters
1.3k
Views
2
Watching
-
Hi!
The following should work:Rectangle { width: 300 height: 100 Text { text: "Hallo!" font.pixelSize: parent.height anchors.centerIn: parent } } -
obtained the margin on the top and bottom of the text
That is, the height of the text < the height of the rectangleThis is a bit better as it seems to use
contentHeightinternally:Rectangle { width: 300 height: 100 anchors.centerIn: parent Text { text: "Äp!" anchors.fill: parent fontSizeMode: Text.VerticalFit font.pixelSize: 1000 } }But still "Hallo!" is not fully scaled up. I think the problem stems from the fact that
contentHeightdoesn't return the actual bounding box of the rendered text but the sum of the cap height and descender height.