summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-11-18 19:21:10 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-20 14:10:18 +0100
commit16ad93af4959b3c0ae96a4a0d88e25c1626f587d (patch)
treecc8dff147ebc7977146ca6bf782d11b621d7b363 /src
parentce6fd574b46cb10204f6ef598ea4377639ad1516 (diff)
iOS: Don't use auto resizing masks to deal with maximized/fullscreen
It breaks down when the view-controller is fullscreen and we want to take statusbar height into account as well. Unfortunately we can't use constraints either, as it's iOS6+. The approach of managing the geometry manually is closer to what Android does as well. Change-Id: Ib521ba0f50b110c440ab68aacef5a524d5d41154 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/ios/qiosscreen.mm3
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm27
2 files changed, 20 insertions, 10 deletions
diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm
index b93511d755..de6585fd19 100644
--- a/src/plugins/platforms/ios/qiosscreen.mm
+++ b/src/plugins/platforms/ios/qiosscreen.mm
@@ -180,6 +180,9 @@ void QIOSScreen::updateProperties()
m_availableGeometry = availableGeometry;
QWindowSystemInterface::handleScreenAvailableGeometryChange(screen(), m_availableGeometry);
}
+
+ if (screen())
+ resizeMaximizedWindows();
}
QRect QIOSScreen::geometry() const
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index de56084848..2413a45e11 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -448,19 +448,26 @@ void QIOSWindow::setWindowState(Qt::WindowState state)
// Perhaps setting QWindow to maximized should also mean that we'll show
// the statusbar, and vice versa for fullscreen?
+ if (state != Qt::WindowNoState)
+ m_normalGeometry = geometry();
+
switch (state) {
+ case Qt::WindowNoState:
+ setGeometry(m_normalGeometry);
+ break;
case Qt::WindowMaximized:
- case Qt::WindowFullScreen: {
- // Since UIScreen does not take orientation into account when
- // reporting geometry, we need to look at the top view instead:
- CGSize fullscreenSize = m_view.window.rootViewController.view.bounds.size;
- m_view.frame = CGRectMake(0, 0, fullscreenSize.width, fullscreenSize.height);
- m_view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- break; }
- default:
- m_view.frame = toCGRect(m_normalGeometry);
- m_view.autoresizingMask = UIViewAutoresizingNone;
+ setGeometry(screen()->availableGeometry());
break;
+ case Qt::WindowFullScreen:
+ setGeometry(screen()->geometry());
+ break;
+ case Qt::WindowMinimized:
+ setGeometry(QRect());
+ break;
+ case Qt::WindowActive:
+ Q_UNREACHABLE();
+ default:
+ Q_UNREACHABLE();
}
}