Add note to QWindow::setGeometry of why we set the screen first

Change-Id: I1c497bb240b23ef96c45c7942d5fd1b650006942
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Tor Arne Vestbø 2025-02-24 17:11:20 +01:00
parent babae98401
commit d038f3d692

View File

@ -1842,6 +1842,13 @@ void QWindow::setGeometry(const QRect &rect)
d->positionPolicy = QWindowPrivate::WindowFrameExclusive;
if (d->platformWindow) {
// Setting a new geometry may move the window to a new screen.
// The QHighDpi layer needs to know the new screen to be able
// to resolve the resulting geometry based on the screen's DPR,
// so we update the screen before passing the geometry on to
// the platform layer. FIXME: Find a way to tell QHighDpi about
// the new screen without actually changing the screen, so that
// the geometry change is the trigger for the screen change.
QScreen *newScreen = d->screenForGeometry(rect);
if (newScreen && isTopLevel())
d->setTopLevelScreen(newScreen, true);