Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Ui wrong size when multiple dpi settings
I have a small problem. I have a multimonitor setup and Windows 8.1; the monitors are different in size, so the OS automatically changes the DPI scaling; particularly the main monitor is bigger (and so the scaling size is greater).
Just to show you, this is an example of two explorer windows. They were spanning over the two monitors, so the OS resized them according to the DPI scaling of the monitor. Particularly the upper one was the one with the primary (bigger) monitor, the lower one with the second one.
Now, problems arise when I create a new QT Widgets UI and try to display it on the two different monitors. I created a simple GUI with some controls and moved it on the two different monitors.
I created it with and without horizontal layouts. You can see here an image showing the comparison of the different results.
As you can see, the text becomes bigger on the second monitor, which is what you would expect since it should be displayed in a proper way. There is an exception, though: the textbox inner text is not scaled.
The major problem, however, is that the widget size is not increased. Look at the widgets in the "without layout" row or at the tab names in both versions: you can clearly see that the labels are cropped at the end of the widget.
Now, is there a fix for this? Is it a bug? Or it is simply the right behavior? I think that the text size should grow, but also the overall size should: the whole window should become bigger, otherwise these artifacts can show.
Hi and welcome to devnet,
Which version of Qt are you using ?
@SGaist Thank you ;)
I'm using Qt 5.7, with the MinGW compiler. I updated it recently (last week, I think).
Do you have the same happening if you open your application directly on the second monitor ?
@SGaist Yes, exactly the same. And I also have the same behavior if I launch the application directly from the exe file.
Did you already check the Windows part of the High DPI documentation ?
Ok, did some tests and it seems that setting the windows:dpiawareness to 0 or 1 fixes the problem.
But... The problem is, the form is much more readable with the scaling at 2, since it is almost the same size on both monitors. The problem is that while the font size increases, the local sizes don't. And so the labels are cropped.
In my opinion, a much better scaling would be to increase also the linear sizes, so that the whole window has almost the same size on both monitors.
I don't know if I could explain well my opinion...