summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsscreen.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-04-23 06:32:56 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-25 08:52:32 +0200
commitf061c413de2e3fdc4cc1578f420651a7c45da3e9 (patch)
tree7ec4dd6cde58865160286d96dcba841b1d3e8e55 /src/plugins/platforms/windows/qwindowsscreen.cpp
parentfc8c011450c0326d05a8c0098a294cafbbb50191 (diff)
Windows: Fix wrong DPI used in font size after changing scaling
QWindowsFontDatabase::defaultVerticalDPI(), which was used for converting the point sizes was missing an updating logic for scaling changes. When implementing it, it turned out that the value obtained from GetDC(0) does not adapt to scaling changes. Remove the function and set it from the screen manager directly to the DPI of the primary screen. Pick-to: 5.15 Task-number: QTBUG-82267 Change-Id: If05ebc893fe78a9461500aba97f2dc127cdf4406 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsscreen.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 8850d8cdd4..689624ff2a 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -51,6 +51,7 @@
#include <QtGui/qguiapplication.h>
#include <qpa/qwindowsysteminterface.h>
#include <private/qhighdpiscaling_p.h>
+#include <private/qwindowsfontdatabasebase_p.h>
#include <QtGui/qscreen.h>
#include <QtCore/qdebug.h>
@@ -111,8 +112,11 @@ static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data)
// EnumDisplayMonitors (as opposed to EnumDisplayDevices) enumerates only
// virtual desktop screens.
data->flags |= QWindowsScreenData::VirtualDesktop;
- if (info.dwFlags & MONITORINFOF_PRIMARY)
+ if (info.dwFlags & MONITORINFOF_PRIMARY) {
data->flags |= QWindowsScreenData::PrimaryScreen;
+ if ((data->flags & QWindowsScreenData::LockScreen) == 0)
+ QWindowsFontDatabase::setDefaultVerticalDPI(data->dpi.second);
+ }
return true;
}