iOS: QIOSWindow::setParent()

Change-Id: I1a413d898d10b55a4d0653eae719f5bd909a01ec
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
bb10
Richard Moe Gustavsen 2013-02-04 12:42:59 +01:00 committed by Tor Arne Vestbø
parent 4993d3ed6b
commit 029029fa97
2 changed files with 12 additions and 3 deletions

View File

@ -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);

View File

@ -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