diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2021-03-16 17:22:28 +0100 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2021-05-03 13:33:43 +0200 |
commit | 51e2a64ed9360c8e889726c3fbaf649a4d260e0d (patch) | |
tree | df8f9cacedfda44291176b5d7ea9cb468912e85c /src/gui/kernel/qhighdpiscaling_p.h | |
parent | d41ef4f741b9b4a26694aab2ebfd9b0e130d8785 (diff) |
Parse QT_SCREEN_SCALE_FACTORS spec only once
Move parsing to initHighDpiScaling() and store the parsed
factors in a vector. The factors are later applied in
updateHighDpiScaling() where the factor list is compared
to the screen list.
Change-Id: I59fc67b84932dbe69868a3683686a91e51333104
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/kernel/qhighdpiscaling_p.h')
-rw-r--r-- | src/gui/kernel/qhighdpiscaling_p.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h index 3e7ba2f5e1..8460b3ec2e 100644 --- a/src/gui/kernel/qhighdpiscaling_p.h +++ b/src/gui/kernel/qhighdpiscaling_p.h @@ -126,11 +126,19 @@ public: static QDpi logicalDpi(const QScreen *screen); private: + struct ScreenFactor { + ScreenFactor(QString name, qreal factor) + :name(name), factor(factor) { } + QString name; + qreal factor; + }; + static qreal rawScaleFactor(const QPlatformScreen *screen); static qreal roundScaleFactor(qreal rawFactor); static QDpi effectiveLogicalDpi(const QPlatformScreen *screen, qreal rawFactor, qreal roundedFactor); static qreal screenSubfactor(const QPlatformScreen *screen); static QScreen *screenForPosition(Point position, QScreen *guess); + static QVector<QHighDpiScaling::ScreenFactor> parseScreenScaleFactorsSpec(const QStringView &screenScaleFactors); static qreal m_factor; static bool m_active; @@ -139,7 +147,7 @@ private: static bool m_globalScalingActive; static bool m_screenFactorSet; static bool m_usePhysicalDpi; - static QString m_screenFactorsSpec; + static QVector<ScreenFactor> m_screenFactors; static DpiAdjustmentPolicy m_dpiAdjustmentPolicy; static QHash<QString, qreal> m_namedScreenScaleFactors; }; |