-
Notifications
You must be signed in to change notification settings - Fork 208
Description
Problem
I run a high DPI display (2560x1600 on a 16 inch laptop), on Windows my OS-wide display scaling is set to 150% (which is Windows' "Recommended" scale factor for this display).
When I run qFlipper, by default it appears a little "too small" for the screen:
If I set QT_SCALE_FACTOR=1.5 and then launch qFlipper, the scaling is perfect:
Both images are screenshots of the full screen, with the Settings window maximised in the background to help give an idea of proportions/scale
Potential cause/fix
On modern Windows systems, fractional scaling factors in increments of 25%/0.25 are very common, and in many cases set by default without the user having to change it.
Currently, qFlipper sets the High DPI scale factor rounding policy to RoundPreferFloor in application/main.cpp:
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor);I note this was added in 701ffe5 "Improve GUI scaling behaviour".
Qt supports a scale factor rounding policy PassThrough, which would respect the scale factors set by Windows, including for non-integer values.
Windows has a well-defined system-wide DPI scaling factor, so PassThrough should work consistently and reliably. But I'm aware this would probably not be the preferred option on Linux, due to not having a single standard for DPI scaling... fragmented configuration... toolkits looking at different environment variables etc.
So to avoid drawbacks on other platforms, you could do something like:
#ifdef Q_OS_WIN
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
#else
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor);
#endifThat way, on Windows, it would be correctly scaled out of the box with no additional workarounds required.
I will do some further testing to see if this would be the correct fix, but wanted to post as an issue rather than a PR to facilitate discussion.