diff options
author | Richard Moe Gustavsen <richard.gustavsen@digia.com> | 2013-02-04 12:42:59 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-02-27 23:56:08 +0100 |
commit | 029029fa97b8f11b2384040f12dc1ca6b31e03a6 (patch) | |
tree | fc6d5fd80e6f392ac5db21e844c2ee7e21a6e374 | |
parent | 4993d3ed6bff681889faec3711fffa2400b7a601 (diff) |
iOS: QIOSWindow::setParent()
Change-Id: I1a413d898d10b55a4d0653eae719f5bd909a01ec
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
-rw-r--r-- | src/plugins/platforms/ios/qioswindow.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qioswindow.mm | 14 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index 7a0224dab0..cefb6f9388 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -65,6 +65,7 @@ public: void setGeometry(const QRect &rect); void setWindowState(Qt::WindowState state); + void setParent(const QPlatformWindow *window); void handleContentOrientationChange(Qt::ScreenOrientation orientation); void setVisible(bool visible); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 9bc2541715..e95f392655 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -324,9 +324,7 @@ QIOSWindow::QIOSWindow(QWindow *window) , m_windowLevel(0) , m_devicePixelRatio(1.0) { - if (isQtApplication()) - [rootViewController().view addSubview:m_view]; - + setParent(parent()); setWindowState(window->windowState()); // Retina support: get screen scale factor and set it in the content view. @@ -424,6 +422,16 @@ 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()) { + [rootViewController().view addSubview:m_view]; + } +} + void QIOSWindow::requestActivateWindow() { // Note that several windows can be active at the same time if they exist in the same |