diff options
-rw-r--r-- | src/gui/kernel/qhighdpiscaling.cpp | 28 | ||||
-rw-r--r-- | src/gui/kernel/qhighdpiscaling_p.h | 4 |
2 files changed, 16 insertions, 16 deletions
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 430f9facec..a2ca58e4c2 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -271,8 +271,8 @@ static inline qreal initialGlobalScaleFactor() qreal QHighDpiScaling::m_factor = 1.0; bool QHighDpiScaling::m_active = false; //"overall active" - is there any scale factor set. -bool QHighDpiScaling::m_usePixelDensity = false; // use scale factor from platform plugin -bool QHighDpiScaling::m_pixelDensityScalingActive = false; // pixel density scale factor > 1 +bool QHighDpiScaling::m_usePlatformPluginDpi = false; // use scale factor based on platform plugin DPI +bool QHighDpiScaling::m_platformPluginDpiScalingActive = false; // platform plugin DPI gives a scale factor > 1 bool QHighDpiScaling::m_globalScalingActive = false; // global scale factor is active bool QHighDpiScaling::m_screenFactorSet = false; // QHighDpiScaling::setScreenFactor has been used @@ -281,9 +281,9 @@ bool QHighDpiScaling::m_screenFactorSet = false; // QHighDpiScaling::setScreenFa platform plugin is created. */ -static inline bool usePixelDensity() +static inline bool usePlatformPluginDpi() { - // Determine if we should set a scale factor based on the pixel density + // Determine if we should set a scale factor based on the logical DPI // reported by the platform plugin. bool enableEnvValueOk; @@ -493,22 +493,22 @@ void QHighDpiScaling::initHighDpiScaling() m_factor = initialGlobalScaleFactor(); m_globalScalingActive = !qFuzzyCompare(m_factor, qreal(1)); - m_usePixelDensity = usePixelDensity(); + m_usePlatformPluginDpi = usePlatformPluginDpi(); - m_pixelDensityScalingActive = false; //set in updateHighDpiScaling below + m_platformPluginDpiScalingActive = false; //set in updateHighDpiScaling below - m_active = m_globalScalingActive || m_usePixelDensity; + m_active = m_globalScalingActive || m_usePlatformPluginDpi; } void QHighDpiScaling::updateHighDpiScaling() { - m_usePixelDensity = usePixelDensity(); + m_usePlatformPluginDpi = usePlatformPluginDpi(); - if (m_usePixelDensity && !m_pixelDensityScalingActive) { + if (m_usePlatformPluginDpi && !m_platformPluginDpiScalingActive ) { const auto screens = QGuiApplication::screens(); for (QScreen *screen : screens) { if (!qFuzzyCompare(screenSubfactor(screen->handle()), qreal(1))) { - m_pixelDensityScalingActive = true; + m_platformPluginDpiScalingActive = true; break; } } @@ -546,7 +546,7 @@ void QHighDpiScaling::updateHighDpiScaling() ++i; } } - m_active = m_globalScalingActive || m_screenFactorSet || m_pixelDensityScalingActive; + m_active = m_globalScalingActive || m_screenFactorSet || m_platformPluginDpiScalingActive ; } /* @@ -561,7 +561,7 @@ void QHighDpiScaling::setGlobalFactor(qreal factor) m_globalScalingActive = !qFuzzyCompare(factor, qreal(1)); m_factor = m_globalScalingActive ? factor : qreal(1); - m_active = m_globalScalingActive || m_screenFactorSet || m_pixelDensityScalingActive; + m_active = m_globalScalingActive || m_screenFactorSet || m_platformPluginDpiScalingActive ; const auto screens = QGuiApplication::screens(); for (QScreen *screen : screens) screen->d_func()->updateHighDpi(); @@ -638,7 +638,7 @@ qreal QHighDpiScaling::screenSubfactor(const QPlatformScreen *screen) } } - if (!screenPropertyUsed && m_usePixelDensity) + if (!screenPropertyUsed && m_usePlatformPluginDpi) factor = roundScaleFactor(rawScaleFactor(screen)); return factor; @@ -650,7 +650,7 @@ QDpi QHighDpiScaling::logicalDpi(const QScreen *screen) if (!screen || !screen->handle()) return QDpi(96, 96); - if (!m_usePixelDensity) { + if (!m_usePlatformPluginDpi) { const qreal screenScaleFactor = screenSubfactor(screen->handle()); const QDpi dpi = QPlatformScreen::overrideDpi(screen->handle()->logicalDpi()); return QDpi{ dpi.first / screenScaleFactor, dpi.second / screenScaleFactor }; diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index 76f0186e69..0a4fb630f6 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -134,9 +134,9 @@ private: static qreal m_factor; static bool m_active; - static bool m_usePixelDensity; + static bool m_usePlatformPluginDpi; + static bool m_platformPluginDpiScalingActive; static bool m_globalScalingActive; - static bool m_pixelDensityScalingActive; static bool m_screenFactorSet; static QDpi m_logicalDpi; }; |