summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qhighdpiscaling.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-01 16:16:14 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-02 10:31:17 +0000
commit1499302bb12cdf81c413a7a9f9ded3036b1a3cfa (patch)
tree809695e86346f07b92a1e89ca15b284550181250 /src/gui/kernel/qhighdpiscaling.cpp
parent88c8a4f961076bed826fc011de19dd711c6160c4 (diff)
Support QT_DEVICE_PIXEL_RATIO
For compatibility with Qt 5.5 (and 5.4) Change-Id: I30fe0e493849f116983299f36061d443a522eec3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/gui/kernel/qhighdpiscaling.cpp')
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp8
1 files changed, 7 insertions, 1 deletions
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;