Details
-
Suggestion
-
Resolution: Done
-
P4: Low
-
None
-
None
-
2b03ab642329d2498eafa35ae7159991db5791e4
Description
This is useful in order to specify font sizes that are some multiple of the default size (which is almost always guaranteed to be a sensible, legible size). For example:
Text {
text: "Large text"
font.pixelSize: Qt.application.font.pixelSize * 2
}
Other options are:
- "<h3>Large text</h3>" - adds extra space below the text since it's a HTML element, so not really useful if you want a decent layout.
- Hard-coding a pixel size. Works OK when used in combination with Qt::AA_EnableHighDpiScaling, and so long as you guess the correct size that works for each platform you're targeting. Doesn't work without setting Qt::AA_EnableHighDpiScaling.
- Using FontMetrics/TextMetrics. Works fine, but is a bit verbose.
- Use an empty Text element. Creates an unnecessary item. Was superseded by FontMetrics/TextMetrics.
- defaultPixelSize/implicitPixelSize and defaultPointSize/implicitPointSize. There are already font-related properties outside of the font grouped property, so this wouldn't be out of place, but the API is already quite large.