Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.9.3, 5.11.1, 5.13
-
Windows 10
Description
Update (Dec 13 2018): I have tested the suggested fix, which is to add
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
before creating QApplication instance. It seems to solve all the problems except for #4 and a new issue with the icons inside QTreeWidget.
Here's what the test application looks like on the primary monitor with 175% scale:
Bug: the triangle icons are blurry. One could think it's simply due to up-scaling, but you can see below that without `AA_EnableHighDpiScaling` they're very crisp.
And here's the secondary monitor with 100% scale. The up/down arrows in the spinbox are still oversized. I also don't like how the QRadioButton circles are rendered.
-----------------------------------------------------------------------------------
Qt has decent high DPI support (good, even), but there's one class of issues still present. When there is more than one monitor in the system, and they have different display scaling factors, Qt always calculates some UI elements based on the primary monitor instead of the monitor the window is on.
I have made a tiny demo to illustrate all the issues that I've noticed at once (hDPI-demo.zip). Steps to reproduce:
- Use a Windows computer with more than one display; set different scaling factors for primary and secondary displays. In the following example the primary display is 4K with 200% scale, the secondary is Full HD with 100% (no scaling).
- Run the attached demo and move it to the secondary monitor. It doesn't matter which monitor the applications starts on initially.
Screenshot from the primary monitor (good):
Secondary monitor (bad):
The size of the text items is correct, while some other elements are over-sized. Namely:
- The radiobutton circles are oversized compared to the text labels.
- The checkbox checkmark is oversized compared to the text labels.
- The button is oversized compared to its caption text.
- The spinbox up/down arrows are oversized.
- The combobox is oversized.
- The icons inside QTreeWidget are oversized.
- The left margin is too large between QTreeWidget edge and the column 0 text label.
- The menu items are oversized, except the top-level menu which is rendered correctly.
- The scroll bars are oversized.
- The layout spacing between adjacent elements (e. g. between the spinbox and the combobox) has equal pixel size on both monitors - 6 px. Probably should be 12 on the primary monitor (the one with 200% scaling).
Attachments
Issue Links
- relates to
-
QTBUG-49374 Adapt Windows style to High DPI
- Closed