From 233b6534a79c09e30b9aeb14dbb1cb469a67f2a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 31 Aug 2020 16:22:46 +0200 Subject: High-DPI: Remove legacy environment variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QT_DEVICE_PIXEL_RATIO is replaced by QT_SCALE_FACTOR, while QT_AUTO_SCREEN_SCALE_FACTOR is replaced by QT_ENABLE_HIGHDPI_SCALING. Since High-DPI is now always enabled, there's no reason to keep the code path for android.app.auto_screen_scale_factor. Also, based on the original commit message that introduced this code, the value of the property should have been true. Change-Id: Ib34b1deeab46c488c67c4d64f087599b4a54dc55 Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qhighdpiscaling.cpp | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 023e19ad9c..53ecf8e0ad 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -55,11 +55,6 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcScaling, "qt.scaling"); #ifndef QT_NO_HIGHDPISCALING -static const char legacyDevicePixelEnvVar[] = "QT_DEVICE_PIXEL_RATIO"; - -// Note: QT_AUTO_SCREEN_SCALE_FACTOR is Done on X11, and should be kept -// working as-is. It's Deprecated on all other platforms. -static const char legacyAutoScreenEnvVar[] = "QT_AUTO_SCREEN_SCALE_FACTOR"; static const char enableHighDpiScalingEnvVar[] = "QT_ENABLE_HIGHDPI_SCALING"; static const char scaleFactorEnvVar[] = "QT_SCALE_FACTOR"; @@ -94,20 +89,8 @@ static inline qreal initialGlobalScaleFactor() qCDebug(lcScaling) << "Apply " << scaleFactorEnvVar << f; result = f; } - } else { - // Check for deprecated environment variables. - if (qEnvironmentVariableIsSet(legacyDevicePixelEnvVar)) { - qWarning("Warning: %s is deprecated. Instead use:\n" - " %s to enable platform plugin controlled per-screen factors.\n" - " %s to set per-screen DPI.\n" - " %s to set the application global scale factor.", - legacyDevicePixelEnvVar, legacyAutoScreenEnvVar, screenFactorsEnvVar, scaleFactorEnvVar); - - int dpr = qEnvironmentVariableIntValue(legacyDevicePixelEnvVar); - if (dpr > 0) - result = dpr; - } } + return result; } @@ -208,17 +191,6 @@ static inline qreal initialGlobalScaleFactor() factor based on display density information. These platforms include X11, Windows, and Android. - There is one API for enabling or disabling this behavior: - - The QT_AUTO_SCREEN_SCALE_FACTOR environment variable. - - Enabling either will make QHighDpiScaling call QPlatformScreen::pixelDensity() - and use the value provided as the scale factor for the screen in - question. Disabling is done on a 'veto' basis where either the - environment or the application can disable the scaling. The intended use - cases are 'My system is not providing correct display density - information' and 'My application needs to work in display pixels', - respectively. - The QT_SCREEN_SCALE_FACTORS environment variable can be used to set the screen scale factors manually. Set this to a semicolon-separated list of scale factors (matching the order of QGuiApplications::screens()), @@ -260,13 +232,8 @@ bool QHighDpiScaling::m_screenFactorSet = false; // QHighDpiScaling::setScreenFa static inline bool usePixelDensity() { // Determine if we should set a scale factor based on the pixel density - // reported by the platform plugin. There are several enablers and several - // disablers. A single disable may veto all other enablers. + // reported by the platform plugin. - bool screenEnvValueOk; - const int screenEnvValue = qEnvironmentVariableIntValue(legacyAutoScreenEnvVar, &screenEnvValueOk); - if (screenEnvValueOk && screenEnvValue < 1) - return false; bool enableEnvValueOk; const int enableEnvValue = qEnvironmentVariableIntValue(enableHighDpiScalingEnvVar, &enableEnvValueOk); if (enableEnvValueOk && enableEnvValue < 1) -- cgit v1.2.3