diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-07-28 13:02:07 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-09-24 11:53:05 +0200 |
commit | 0cd3416136210397ef4843224181445a81bdf0f9 (patch) | |
tree | 56f973915e73e94fd92baa6ac0bb4c86e90a6ae1 /src/plugins | |
parent | e3a72a8aee174dc51eff598c45d426d45c1d83aa (diff) |
iOS: Simplify QWindow/UIView geometry mapping
As we now have a root viewcontroller that always has a geometry that matches
the containing UIWindow, we don't need to do any fancy calculations when
mapping between the two.
Change-Id: I08a7b9992be7b7238cbad2a2da20488bba1c0939
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/ios/qioswindow.mm | 19 | ||||
-rw-r--r-- | src/plugins/platforms/ios/quiview.mm | 15 |
2 files changed, 2 insertions, 32 deletions
diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 2874d272fe..1c9fc6f28a 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -178,24 +178,7 @@ void QIOSWindow::applyGeometry(const QRect &rect) // The baseclass takes care of persisting this for us. QPlatformWindow::setGeometry(rect); - if (window()->isTopLevel()) { - // The QWindow is in QScreen coordinates, which maps to a possibly rotated root-view-controller. - // Since the root-view-controller might be translated in relation to the UIWindow, we need to - // check specifically for that and compensate. Also check if the root view has been scrolled - // as a result of the keyboard being open. - UIWindow *uiWindow = m_view.window; - UIView *rootView = uiWindow.rootViewController.view; - CGRect rootViewPositionInRelationToRootViewController = - [rootView convertRect:uiWindow.bounds fromView:uiWindow]; - - m_view.frame = CGRectOffset([m_view.superview convertRect:toCGRect(rect) fromView:rootView], - rootViewPositionInRelationToRootViewController.origin.x, - rootViewPositionInRelationToRootViewController.origin.y - + rootView.bounds.origin.y); - } else { - // Easy, in parent's coordinates - m_view.frame = toCGRect(rect); - } + m_view.frame = toCGRect(rect); // iOS will automatically trigger -[layoutSubviews:] for resize, // but not for move, so we force it just in case. diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm index 3040e89864..444017f4c7 100644 --- a/src/plugins/platforms/ios/quiview.mm +++ b/src/plugins/platforms/ios/quiview.mm @@ -135,20 +135,7 @@ // from what we end up with after applying window constraints. QRect requestedGeometry = m_qioswindow->geometry(); - QRect actualGeometry; - if (m_qioswindow->window()->isTopLevel()) { - UIWindow *uiWindow = self.window; - UIView *rootView = uiWindow.rootViewController.view; - CGRect rootViewPositionInRelationToRootViewController = - [rootView convertRect:uiWindow.bounds fromView:uiWindow]; - - actualGeometry = fromCGRect(CGRectOffset([self.superview convertRect:self.frame toView:rootView], - -rootViewPositionInRelationToRootViewController.origin.x, - -rootViewPositionInRelationToRootViewController.origin.y - + rootView.bounds.origin.y)).toRect(); - } else { - actualGeometry = fromCGRect(self.frame).toRect(); - } + QRect actualGeometry = fromCGRect(self.frame).toRect(); // Persist the actual/new geometry so that QWindow::geometry() can // be queried on the resize event. |