From 080a8285eb64119d1261be7d1d9eca883bf45826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 12 Sep 2019 12:01:28 +0200 Subject: [PATCH] High-DPI: Enable scaling by default in Qt 6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/gui/kernel/qhighdpiscaling.cpp | 10 +++------- 1 file 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)