Set Qt::SubWindow on windows embedded by QWidget::createWindowContainer

The embedded window is parented into the containing QWindowContainer
widget, which may either have a window handle itself, or is a child
of a widget that has one (typically the top level).

By setting Qt::SubWindow we inform clients about the embedded window's
place in the world, allowing e.g. QPlatformIntegration::defaultWindowState
to choose the correct state (Qt::WindowNoState) for the window instead of
making it Qt::WindowMaximized on iOS.

Pick-to: 6.2 6.2.0
Change-Id: Icf834192d99fee455aaba3c57bee1a4f1fde5025
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Tor Arne Vestbø 2021-09-09 17:45:42 +02:00
parent c066cd2600
commit 296621a52f

View File

@ -234,6 +234,8 @@ QWindowContainer::QWindowContainer(QWindow *embeddedWindow, QWidget *parent, Qt:
d->fakeParent.setObjectName(windowName + QLatin1String("ContainerFakeParent"));
d->window->setParent(&d->fakeParent);
d->window->setFlag(Qt::SubWindow);
setAcceptDrops(true);
connect(QGuiApplication::instance(), SIGNAL(focusWindowChanged(QWindow*)), this, SLOT(focusWindowChanged(QWindow*)));