Restore WindowState when changing SurfaceType

Restore the WindowState, when a Window has to be recreated due to
changed SurfaceType.

Fixes: QTBUG-118194
Pick-to: 6.6 6.5
Change-Id: I40ba552cda9dfc8ab543611595c068f80b8fa1d6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Wladimir Leuschner 2023-11-06 16:19:57 +01:00
parent b23a06e039
commit c88211d1e4
1 changed files with 2 additions and 0 deletions

View File

@ -10866,8 +10866,10 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
recreate = true;
}
if (recreate) {
auto oldState = d->windowHandle(QWidgetPrivate::WindowHandleMode::Closest)->windowState();
newtlw->destroy();
newtlw->create();
d->windowHandle(QWidgetPrivate::WindowHandleMode::Closest)->setWindowState(oldState);
}
}
}