There are many situations while creating a custom widget in QT where it's not possible to use relative sizes:
- Height of a button
- Default width of a vertical scroll-bar
- etc..
Several approach could be used for this:
- Using the screen DPI value: However, some devices are designed for a different distance to the user, like a 40" screen compared with a smart-phone. Making the application a fixed size would not be friendly for both types of users. Additionally, not sure how this would behave with multiple screens.
- Using the font size: A font is not supposed to be a UI scale configuration, this wrong design will carry soon or late unexpected behaviours.
- Do not scale the widget, QT_SCALE_FACTOR will do: Seem not updated in many situations (e.g. on my laptop 4k with 168dpi it is set to 1, but it could be a misconfiguration)
- ...
The question is:
What is the standard/common approach for fixed sizes in custom widgets?
Other related sources:
How to approach development of new Qt 5.7+ High-DPI Per Monitor DPI Aware application?