summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-01 13:06:14 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-01 11:21:29 +0000
commit88c8a4f961076bed826fc011de19dd711c6160c4 (patch)
tree6e8c1ef535ec2cfe46d3b42e9eb53aac86e4e128 /src/gui/kernel
parentb970d03863e88b4aa3c26149bce3511174faadbd (diff)
usePixelDensity and perScreenActive are different concepts
Previously, setting a scale factor on a screen would also turn on pixel density scaling. Scaling everything twice is not twice as good... Change-Id: I617b76a717c8f83089d534604b3596754c42dad4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp13
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h1
2 files changed, 9 insertions, 5 deletions
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index a1387f781b..122e746f07 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -81,16 +81,18 @@ static inline qreal initialScaleFactor()
qreal QHighDpiScaling::m_factor;
bool QHighDpiScaling::m_active; //"overall active" - is there any scale factor set.
-bool QHighDpiScaling::m_perScreenActive;
+bool QHighDpiScaling::m_perScreenActive; // different screens may have different scale
+bool QHighDpiScaling::m_usePixelDensity; // use scale factor from platform plugin
void QHighDpiScaling::initHighDPiScaling()
{
- QHighDpiScaling::m_factor = initialScaleFactor();
+ m_factor = initialScaleFactor();
bool usePlatformPluginPixelDensity = qEnvironmentVariableIsSet("QT_AUTO_SCREEN_SCALE_FACTOR");
// m_active below is "overall active" - is there any scale factor set.
- QHighDpiScaling::m_active = !qFuzzyCompare(m_factor, qreal(1)) || usePlatformPluginPixelDensity;
- QHighDpiScaling::m_perScreenActive = usePlatformPluginPixelDensity;
+ m_active = !qFuzzyCompare(m_factor, qreal(1)) || usePlatformPluginPixelDensity;
+ m_usePixelDensity = usePlatformPluginPixelDensity;
+ m_perScreenActive = m_usePixelDensity;
}
/*
@@ -162,7 +164,8 @@ qreal QHighDpiScaling::screenSubfactor(const QPlatformScreen *screen)
{
qreal factor = qreal(1.0);
if (m_perScreenActive && screen) {
- factor *= screen->pixelDensity();
+ if (m_usePixelDensity)
+ factor *= screen->pixelDensity();
QVariant screenFactor = screen->screen()->property(scaleFactorProperty);
if (screenFactor.isValid())
factor *= screenFactor.toReal();
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
index a5d4c40a07..827c21ad5c 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -101,6 +101,7 @@ private:
static qreal m_factor;
static bool m_active;
static bool m_perScreenActive;
+ static bool m_usePixelDensity;
};
// Coordinate system conversion functions: