From b1cfa62ff45cc4b5c035fc5dbe49461e9fe6052a Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 7 Dec 2012 16:22:48 +0100 Subject: iOS: let fullscreen geometry take orientation into account MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since UIScreen is orientation agnostic, we need to look at the view of the top level view controller instead to determine available geometry. Change-Id: I3789ab7972a9970e46fbc8af81f2b7199e5ca5d1 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.mm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 2b97695a10..266000d2de 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -232,10 +232,13 @@ void QIOSWindow::setWindowState(Qt::WindowState state) switch (state) { case Qt::WindowMaximized: - case Qt::WindowFullScreen: - m_view.frame = toCGRect(QRect(QPoint(0, 0), window()->screen()->availableSize())); + 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; + break; } default: m_view.frame = toCGRect(geometry()); m_view.autoresizingMask = UIViewAutoresizingNone; -- cgit v1.2.3