antonypro/QGoodWindow

[Qt 6] QGoodWindow breaks on Windows with scaling values different from 100%

Closed this issue · 9 comments

QGoodWindow breaks on Windows with scaling values different from 100%, as seen below:

image
Scaling 100%, QGoodWindow is present


image
Scaling 100%, QGoodWindow is bypassed


image
Scaling 125%, QGoodWindow is present


image
Scaling 125%, QGoodWindow is bypassed

Another thing I noticed is that the QGoodWindow shadow on Windows 10 also behaves weirdly. I might send a video demonstrating this later.

Source code for this is here (EDIT: removed the link since it was unnecessary) (run with -q as an argument to bypass QGoodWindow).

Checked if this occurs with GoodShowCase. It seems to work fine (although the title bar doesn't increase in size). Strange, I can't find anything in the code that could be causing this (at least not yet).

I'll just try to use GoodShowCase's code, essentially replacing the main window contents of it with mine. (I'll keep the copyright notice and the license, of course)

Still curious about what exactly is causing this.

ExampleMinimal seems to exhibit the same behavior (not working properly)
image
Here's the shadow issue as I mentioned.

After some tinkering, I found out that the GoodShowCase build I had that "worked" didn't scale all elements. After rebuilding with Qt 5.15.2 I got the same result. With Qt 6.4.1 the window exhibits the same issue as in the images above, however the scaling is more consistent. (see both below)

image
Here's a comparison between the Qt 6.4.1 build and the Qt 5.15.2 build (125% scaling)


image
Here's the same comparison, this time the scaling is 100%

@kresimirko: Hi! The problem, as you noted, is automatic scaling in Qt 6.

The solution, if you plan to develop only for Qt 6 is put…

qputenv("QT_ENABLE_HIGHDPI_SCALING", "0");

...before QApplication a(argc, argv);. This disables the automatic scaling of Qt 6, and force the app to behaves like in Qt 5.

If you could, please confirm this for me or point that this is not the solution.

If this solves the problem, I will include a more elegant solution to the problem on next version.

Thanks!

Just tried that and, yes, it does prevent the app from scaling.

image

Just asking, will a future QGoodWindow version be compatible with automatic scaling (if that's what You meant by a "more elegant solution")?

@kresimirko: For the next immediate version, I’m planning to only add to QGoodWindow a static function that calls qputenv("QT_ENABLE_HIGHDPI_SCALING", "0"); only on Qt 6, in Qt 5 it will do nothing. No change in the scale behavior planned for now.

Okay. Thanks for answering.

The static function QGoodWindow::setup(); was added in version 2.1 and should be called before QApplication.