Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.4.0, 5.5.0
-
None
-
Windows 10.
-
f3a4b4258f2d207b5a8e73d62822a3afe1bf8a72 cd2b5f1ada07fc7a5ec31e3b48a7fdf76bf62020
Description
I have attached a very simple Qt app.
1. On Windows 10, set up a multi-monitor display.
2. Keep the main monitor at 100% and set the second to 200% for text scaling. This can be done in display settings.
3. Launch the attached app.
Expected: The QLabel, and main window grow as you move it to the higher DPI screen and shrink when you move it back.
Actual: The text gets bigger, but the label's size doesn't change (so it clips) and the main window doesn't grow bigger.
Further investigation reveals a few conclusions
1. QFont created with default constructor should rare if ever be used. It uses the App's DPI. The QWidget you are using the font with should be passed in so it can get the proper DPI from it. Debugging the QFont revealed that most of the QFont's moving around (except painters) get the wrong DPI set.
2. Widgets are caching their size hints, like QLabel and not reacting to changed screen DPI. When the DPI changes, their size hint cache should be invalidated
3. Qt in general doesn't handle switching DPI's.
Qt Designer, Creator and Assistant show the same problems becoming unusable when moving to a high DPI screen. The scenario above covers the user with their high DPI laptop connected to a standard DPI projector, or the user with only one high DPI monitor connected to their PC (and one normal).
There are a lot more problems then this QLabel. This is the results of debugging this one case.
Attachments
For Gerrit Dashboard: QTBUG-48242 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
185451,2 | Resize the window when the screen's dpi changes | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |
185538,2 | QWidget: update the font when the screen is changed | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |
186431,7 | Fix DPI of QWidget with parent on a different screen | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |