From 88c8a4f961076bed826fc011de19dd711c6160c4 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 1 Jun 2015 13:06:14 +0200 Subject: 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 Reviewed-by: Paul Olav Tvete --- src/gui/kernel/qhighdpiscaling.cpp | 13 ++++++++----- src/gui/kernel/qhighdpiscaling_p.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/gui/kernel') 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: -- cgit v1.2.3