From 1499302bb12cdf81c413a7a9f9ded3036b1a3cfa Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 1 Jun 2015 16:16:14 +0200 Subject: Support QT_DEVICE_PIXEL_RATIO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For compatibility with Qt 5.5 (and 5.4) Change-Id: I30fe0e493849f116983299f36061d443a522eec3 Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qhighdpiscaling.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/gui/kernel/qhighdpiscaling.cpp') diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 122e746f07..4a71f12a5a 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcScaling, "qt.scaling"); +static const char legacyEnvVar[] = "QT_DEVICE_PIXEL_RATIO"; + static inline qreal initialScaleFactor() { static const char envVar[] = "QT_SCALE_FACTOR"; @@ -63,6 +65,10 @@ static inline qreal initialScaleFactor() qCDebug(lcScaling) << "Apply QT_SCALE_FACTOR" << f; result = f; } + } else { + int dpr = qEnvironmentVariableIntValue(legacyEnvVar); + if (dpr > 0) + result = dpr; } return result; } @@ -87,7 +93,7 @@ bool QHighDpiScaling::m_usePixelDensity; // use scale factor from platform plugi void QHighDpiScaling::initHighDPiScaling() { m_factor = initialScaleFactor(); - bool usePlatformPluginPixelDensity = qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR"); + bool usePlatformPluginPixelDensity = qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR") || qgetenv(legacyEnvVar).toLower() == "auto"; // m_active below is "overall active" - is there any scale factor set. m_active = !qFuzzyCompare(m_factor, qreal(1)) || usePlatformPluginPixelDensity; -- cgit v1.2.3