diff options
-rw-r--r-- | src/plugins/platforms/ios/qioswindow.mm | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 6c4614408d..0b09e73a7d 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -250,17 +250,10 @@ void QIOSWindow::setWindowState(Qt::WindowState state) void QIOSWindow::setParent(const QPlatformWindow *parentWindow) { - if (parentWindow) { - UIView *parentView = reinterpret_cast<UIView *>(parentWindow->winId()); - [parentView addSubview:m_view]; - } else if (isQtApplication()) { - for (UIWindow *uiWindow in [[UIApplication sharedApplication] windows]) { - if (uiWindow.screen == static_cast<QIOSScreen *>(screen())->uiScreen()) { - [uiWindow.rootViewController.view addSubview:m_view]; - break; - } - } - } + UIView *parentView = parentWindow ? reinterpret_cast<UIView *>(parentWindow->winId()) + : isQtApplication() ? static_cast<QIOSScreen *>(screen())->uiWindow().rootViewController.view : 0; + + [parentView addSubview:m_view]; } void QIOSWindow::requestActivateWindow() |