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>
This commit is contained in:
parent
32692667a6
commit
942de89562
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user