iOS: Make setFrame in desktop view take superview transforms into account

An assumption we do for the QIOSDesktopManagerView is that it should always
cover the whole UIWindow. To achieve that, we override setFrame to be stop
any attempt from UIKit to make our view smaller, e.g. when the statusbar
changes height.

In case the view is not a direct child of the window, we need to take
any transformations into account when computing the new frame. This
happens e.g. during presentation of other view-controllers, where our
view is temporarily reparented into a UITransitionView that may have
a transform set.

Task-number: QTBUG-47506
Change-Id: I388143f2cbb566541ffb1068443ce21e62ea2b42
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
Tor Arne Vestbø 2015-08-24 16:37:34 +02:00
parent 064439eae4
commit 7010da2e62

View File

@ -185,7 +185,14 @@
- (void)setFrame:(CGRect)newFrame
{
[super setFrame:CGRectMake(0, 0, CGRectGetWidth(newFrame), CGRectGetHeight(self.window.bounds))];
Q_UNUSED(newFrame);
Q_ASSERT(!self.window || self.window.rootViewController.view == self);
// When presenting view controllers our view may be temporarily reparented into a UITransitionView
// instead of the UIWindow, and the UITransitionView may have a transform set, so we need to do a
// mapping even if we still expect to always be the root view-controller.
CGRect transformedWindowBounds = [self.superview convertRect:self.window.bounds fromView:self.window];
[super setFrame:transformedWindowBounds];
}
- (void)setBounds:(CGRect)newBounds