From ed950a8ec194eb35a1035c417aa99de7d38b433d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 16 Jan 2015 17:56:47 +0100 Subject: [PATCH] iOS: Simplify QIOSWindow::setParent() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I78c47c6ccdb53045f3fa412b1489e08691d3e195 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.mm | 15 ++++----------- 1 file 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(parentWindow->winId()); - [parentView addSubview:m_view]; - } else if (isQtApplication()) { - for (UIWindow *uiWindow in [[UIApplication sharedApplication] windows]) { - if (uiWindow.screen == static_cast(screen())->uiScreen()) { - [uiWindow.rootViewController.view addSubview:m_view]; - break; - } - } - } + UIView *parentView = parentWindow ? reinterpret_cast(parentWindow->winId()) + : isQtApplication() ? static_cast(screen())->uiWindow().rootViewController.view : 0; + + [parentView addSubview:m_view]; } void QIOSWindow::requestActivateWindow()