High-DPI: Don’t round scale factors in Qt 6

Set HighDpiScaleFactorRoundingPolicy to PassThough
by default. This makes Qt track the system UI setting
accurately, and is overall the least confusing option.

Historically, Qt has rounded the scale factor (for example,
Windows 175% -> DPR 2) due to faulty handling of fractional
scale factors in Qt Widgets and with the native Windows
style.

Other areas of Qt such as Qt Quick have had few issues
with fractional scale factors and support this well.

Qt has never rounded the scale factor on the Android
platform.

Support for fractional scale factors in Qt Widgets and
the windows style has improved, which makes changing
the default for Qt 6 viable.

Task-number: QTBUG-83068
Change-Id: I38b60f621f95be8ebb6cb84a07d3370fec19ab92
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
bb10
Morten Johan Sørvig 2019-09-12 10:22:14 +02:00 committed by Tor Arne Vestbø
parent 080a8285eb
commit 89e1289b2a
1 changed files with 1 additions and 6 deletions

View File

@ -149,13 +149,8 @@ QString QGuiApplicationPrivate::styleOverride;
Qt::ApplicationState QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive;
Qt::HighDpiScaleFactorRoundingPolicy QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy =
#ifdef Q_OS_ANDROID
// On Android, Qt has newer rounded the scale factor. Preserve
// that behavior by disabling rounding by default.
Qt::HighDpiScaleFactorRoundingPolicy::PassThrough;
#else
Qt::HighDpiScaleFactorRoundingPolicy::Round;
#endif
bool QGuiApplicationPrivate::highDpiScalingUpdated = false;
QPointer<QWindow> QGuiApplicationPrivate::currentDragWindow;