summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-11-25 15:45:43 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-25 23:56:40 +0100
commitc2f08598e1cc3089505dd8037d333071da0f231f (patch)
tree5955d9111e18e2351e4e3806a672b35f9d702cae /src/plugins/platforms/ios
parent6820ac594af949527d17d0b32205377fc767f527 (diff)
iOS: Update statusbar visibility and screen properties before window geometry
When setting a new window state. Otherwise we set the geometry based on the old screen properties, and then rely on the properties causing another window layout, which may not always happen. We also need to explicitly update the screen properties when the statusbar changes visibility, as there are no callbacks from iOS that consistently gives us that information. Change-Id: I1c3328aa3f34d294bc7db8884e611d205fd2c761 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm4
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm16
2 files changed, 12 insertions, 8 deletions
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index 7746163357..57522cb1a3 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -205,10 +205,14 @@ void QIOSScreen::updateStatusBarVisibility()
} else
#endif
{
+ bool wasHidden = [UIApplication sharedApplication].statusBarHidden;
QIOSViewController *viewController = static_cast<QIOSViewController *>(view.viewController);
[[UIApplication sharedApplication]
setStatusBarHidden:[viewController prefersStatusBarHidden]
withAnimation:UIStatusBarAnimationNone];
+
+ if ([UIApplication sharedApplication].statusBarHidden != wasHidden)
+ updateProperties();
}
}
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 66552fae4f..0dd810bdf6 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -581,6 +581,14 @@ void QIOSWindow::applyGeometry(const QRect &rect)
void QIOSWindow::setWindowState(Qt::WindowState state)
{
+ // Update the QWindow representation straight away, so that
+ // we can update the statusbar visibility based on the new
+ // state before applying geometry changes.
+ qt_window_private(window())->windowState = state;
+
+ if (window()->isTopLevel() && window()->isVisible() && window()->isActive())
+ static_cast<QIOSScreen *>(screen())->updateStatusBarVisibility();
+
switch (state) {
case Qt::WindowNoState:
applyGeometry(m_normalGeometry);
@@ -599,14 +607,6 @@ void QIOSWindow::setWindowState(Qt::WindowState state)
default:
Q_UNREACHABLE();
}
-
- if (window()->isTopLevel() && window()->isVisible() && window()->isActive()) {
- // The window state of the QWindow is not updated until after
- // we return from this method, so we have to defer any updates
- // of the statusbar that depend on the current window state.
- QMetaObject::invokeMethod(static_cast<QIOSScreen *>(screen()),
- "updateStatusBarVisibility", Qt::QueuedConnection);
- }
}
void QIOSWindow::setParent(const QPlatformWindow *parentWindow)