iOS: activate next window when active window hides

Since the OS does not handle window management for us, we need
to handle this ourselves. So when a QWindow is closed or hidden, we
transfer activation to the top-most visible window. This will fix
application unresponsive after closing a dialog.

Change-Id: I83f836ebafa71edca5ab5ae3a2bdba7cd1decbc1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
bb10
Richard Moe Gustavsen 2012-12-19 11:05:27 +01:00 committed by Tor Arne Vestbø
parent 646b1fd2b6
commit 1ff571142d
1 changed files with 15 additions and 1 deletions

View File

@ -260,7 +260,21 @@ QIOSWindow::~QIOSWindow()
void QIOSWindow::setVisible(bool visible)
{
QPlatformWindow::setVisible(visible);
[m_view setHidden:!visible];
m_view.hidden = !visible;
if (isQtApplication() && !visible) {
// Activate top-most visible QWindow:
NSArray *subviews = rootViewController().view.subviews;
for (int i = int(subviews.count) - 1; i >= 0; --i) {
UIView *view = [subviews objectAtIndex:i];
if (!view.hidden) {
if (QWindow *window = view.qwindow) {
QWindowSystemInterface::handleWindowActivated(window);
break;
}
}
}
}
}
void QIOSWindow::setGeometry(const QRect &rect)