diff options
-rw-r--r-- | src/plugins/platforms/ios/qioswindow.mm | 6 | ||||
-rw-r--r-- | tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 6b1f603225..027752248c 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -55,8 +55,10 @@ QIOSWindow::QIOSWindow(QWindow *window, WId nativeHandle) connect(qGuiApp, &QGuiApplication::applicationStateChanged, this, &QIOSWindow::applicationStateChanged); - if (QPlatformWindow::parent()) - setParent(QPlatformWindow::parent()); + // Always set parent, even if we don't have a parent window, + // as we use setParent to reparent top levels into our desktop + // manager view. + setParent(QPlatformWindow::parent()); if (!isForeignWindow()) { // Resolve default window geometry in case it was not set before creating the diff --git a/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp index 526abd6ea3..fdb1b333ef 100644 --- a/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp @@ -172,6 +172,9 @@ void tst_ForeignWindow::destroyWhenParentIsDestroyed() // Reparenting into a window will result in creating it QVERIFY(parentWindow.handle()); + parentWindow.show(); + QVERIFY(QTest::qWaitForWindowExposed(&parentWindow)); + // Destroying the parent window of the foreign window results // in destroying the foreign window as well, as the foreign // window no longer has a parent it can be embedded in. @@ -184,6 +187,9 @@ void tst_ForeignWindow::destroyWhenParentIsDestroyed() foreignWindow->create(); QVERIFY(foreignWindow->handle()); QTRY_COMPARE(nativeWindow.parentWinId(), parentWindow.winId()); + + parentWindow.show(); + QVERIFY(QTest::qWaitForWindowExposed(&parentWindow)); } #include <tst_foreignwindow.moc> |