diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2019-09-12 12:01:28 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-08-28 13:00:08 +0200 |
commit | 080a8285eb64119d1261be7d1d9eca883bf45826 (patch) | |
tree | ace72bcefd3f95421d95da27f44db7238448c5c7 /src/gui/kernel | |
parent | 756d7facf6c862faea1fdeadafba361f248328cf (diff) |
High-DPI: Enable scaling by default in Qt 6
Enable high-DPI support for all platforms which use
QHighDpiScaling. This changes the default behavior
of Qt applications on X11, Windows, and Android.
Qt::AA_EnableHighDpiScaling is now effectively on by
default, and Qt 6 applications do not have to set
this application attribute. Opting out is possible by
setting the Qt::AA_DisableHighDpiScaling attribute.
Task-number: QTBUG-83068
Change-Id: Ia2bd3e6f490130afcacd3a951bc50dbb40a79d7f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qhighdpiscaling.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 6c672ca7bf..816c3ccc4b 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -265,7 +265,7 @@ static inline bool usePixelDensity() // reported by the platform plugin. There are several enablers and several // disablers. A single disable may veto all other enablers. - // First, check of there is an explicit disable. + // Check if there is an explicit disable if (QCoreApplication::testAttribute(Qt::AA_DisableHighDpiScaling)) return false; bool screenEnvValueOk; @@ -277,12 +277,8 @@ static inline bool usePixelDensity() if (enableEnvValueOk && enableEnvValue < 1) return false; - // Then return if there was an enable. - return QCoreApplication::testAttribute(Qt::AA_EnableHighDpiScaling) - || (screenEnvValueOk && screenEnvValue > 0) - || (enableEnvValueOk && enableEnvValue > 0) - || (qEnvironmentVariableIsSet(legacyDevicePixelEnvVar) - && qEnvironmentVariable(legacyDevicePixelEnvVar).compare(QLatin1String("auto"), Qt::CaseInsensitive) == 0); + // Enable by default + return true; } qreal QHighDpiScaling::rawScaleFactor(const QPlatformScreen *screen) |