summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2012-12-10 10:18:59 +0100
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-02-27 23:55:50 +0100
commita1c9f565521f971adbb1e6aad6b82d194f1a1905 (patch)
treeef1b4f47e8b7c6c0f9f2cd2dcacedbd2fbc2080a /src
parentb1cfa62ff45cc4b5c035fc5dbe49461e9fe6052a (diff)
iOS: update QPlatformWindow::geometry() when UIView changes size
It turns out that QWindow::geometry needs to be updated manually by the platform plugin, and not indirectly trough QWindowSystemInterface::handleGeometryChange as first assumed. We now always report the _actual_ geometry of the UIView (which also takes the status bar into account) to QWindow, and remember the _requested_ geometry of the window to use whenever the state of the window changes. Change-Id: Iea940173d26fb6af701234379cae914215dae984 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/ios/qioswindow.h1
-rw-r--r--src/plugins/platforms/ios/qioswindow.mm9
2 files changed, 7 insertions, 3 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h
index df632e672e..2a762d2bdc 100644
--- a/src/plugins/platforms/ios/qioswindow.h
+++ b/src/plugins/platforms/ios/qioswindow.h
@@ -93,6 +93,7 @@ public:
private:
EAGLView *m_view;
+ QRect m_requestedGeometry;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm
index 266000d2de..b209bbc159 100644
--- a/src/plugins/platforms/ios/qioswindow.mm
+++ b/src/plugins/platforms/ios/qioswindow.mm
@@ -113,7 +113,9 @@ static QRect fromCGRect(const CGRect &rect)
qWarning() << m_qioswindow->window()
<< "is backed by a UIView that has a transform set. This is not supported.";
- QWindowSystemInterface::handleGeometryChange(m_qioswindow->window(), fromCGRect(self.frame));
+ QRect geometry = fromCGRect(self.frame);
+ m_qioswindow->QPlatformWindow::setGeometry(geometry);
+ QWindowSystemInterface::handleGeometryChange(m_qioswindow->window(), geometry);
[super layoutSubviews];
}
@@ -197,6 +199,7 @@ QT_BEGIN_NAMESPACE
QIOSWindow::QIOSWindow(QWindow *window)
: QPlatformWindow(window)
, m_view([[EAGLView alloc] initWithQIOSWindow:this])
+ , m_requestedGeometry(QPlatformWindow::geometry())
{
if ([[UIApplication sharedApplication].delegate isKindOfClass:[QIOSApplicationDelegate class]])
[[UIApplication sharedApplication].delegate.window.rootViewController.view addSubview:m_view];
@@ -213,7 +216,7 @@ void QIOSWindow::setGeometry(const QRect &rect)
{
// If the window is in fullscreen, just bookkeep the requested
// geometry in case the window goes into Qt::WindowNoState later:
- QPlatformWindow::setGeometry(rect);
+ m_requestedGeometry = rect;
if (window()->windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen))
return;
@@ -240,7 +243,7 @@ void QIOSWindow::setWindowState(Qt::WindowState state)
m_view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
break; }
default:
- m_view.frame = toCGRect(geometry());
+ m_view.frame = toCGRect(m_requestedGeometry);
m_view.autoresizingMask = UIViewAutoresizingNone;
break;
}