diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2022-03-11 12:00:12 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-03-29 12:35:50 +0000 |
commit | 942de89562f363afcd4a399dcd55c64792fd5b7c (patch) | |
tree | e815408c6d157c483477283bc6e69a21befee80b /src/gui/kernel | |
parent | 32692667a625f31aa02e0303f2139c780ae42694 (diff) |
Fix high-dpi and QScreen state initialization
Fix bug where QScreen::geometry() returns incorrect
(unscaled) geometry.
We maintain state:
- QHighDpiScaling::m_active, which is set to true
if any screen in QGuiApplication::screens() has a
scale factor > 1, in updateHighDpiScaling()
- QScreen::m_geometry, which is assigned the scaled
screen size in QScreenPrivate::updateHighDpi()
Now the problem is that updateHighDpiScaling() requires
an up-to date screens list, and that updateHighDpi()
requires an up-to date m_active, and that currently
updateHighDpi() is called when constructing the QScreen
only.
This is all a bit unsatisfactory, but for now fix this
in the simplest way by adding a second call to
updateHighDpi() in handleScreenAdded(), after the call
to updateHighDpiScaling().
Pick-to: 6.2 6.3
Fixes-number: QTBUG-101601
Change-Id: I5f442ceb966c77d6746ee885203b67da96612587
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index d66cefb2a9..9410b2fb9d 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -43,6 +43,7 @@ #include "private/qevent_p.h" #include "private/qeventpoint_p.h" #include "private/qpointingdevice_p.h" +#include "private/qscreen_p.h" #include <QAbstractEventDispatcher> #include <qpa/qplatformintegration.h> #include <qdebug.h> @@ -785,6 +786,7 @@ void QWindowSystemInterface::handleScreenAdded(QPlatformScreen *ps, bool isPrima QGuiApplicationPrivate::resetCachedDevicePixelRatio(); QHighDpiScaling::updateHighDpiScaling(); + screen->d_func()->updateHighDpi(); emit qGuiApp->screenAdded(screen); |