diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-07-25 15:38:41 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-09-24 11:52:50 +0200 |
commit | df734769d39ba98be798c0657174bff45c1ccf6f (patch) | |
tree | 77e9af7eef7c1b93fcb3e9c01ff177f1e263d7db /src/plugins/platforms/ios/qiosviewcontroller.mm | |
parent | 4f0cd0693a3aadbf3277dba0eb902db2c78f60cd (diff) |
iOS: Move top level window management out of QIOSScreen to QIOSDesktopManagerView
The logic of how to deal with top level windows in the presence of rotation
or status bar changes should be confined to our custom QIOSViewController
that acts as a desktop manager for regular Qt applications.
We no longer treat windows with full-screen or maximized geometry but without
the matching window state flag as being targeted for auto-resizing. In the
future we might detect this case and warn the user that windows should have
the appropriate flags to be able to auto-resize on orientation changes.
Change-Id: Ibab09de5cf37e77c356fbf51a54a2fcec4bb5c51
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios/qiosviewcontroller.mm')
-rw-r--r-- | src/plugins/platforms/ios/qiosviewcontroller.mm | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 940e6b075e..782c98f66e 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -50,6 +50,39 @@ #include "qiosscreen.h" #include "qiosglobal.h" #include "qioswindow.h" +#include "quiview.h" + +// ------------------------------------------------------------------------- + +@interface QIOSDesktopManagerView : UIView +@end + +@implementation QIOSDesktopManagerView + +- (void)layoutSubviews +{ + for (int i = int(self.subviews.count) - 1; i >= 0; --i) { + UIView *view = static_cast<UIView *>([self.subviews objectAtIndex:i]); + if (![view isKindOfClass:[QUIView class]]) + continue; + + [self layoutView: static_cast<QUIView *>(view)]; + } +} + +- (void)layoutView:(QUIView *)view +{ + QWindow *window = view.qwindow; + Q_ASSERT(window->handle()); + + // Re-apply window states to update geometry + if (window->windowState() & (Qt::WindowFullScreen | Qt::WindowMaximized)) + window->handle()->setWindowState(window->windowState()); +} + +@end + +// ------------------------------------------------------------------------- @implementation QIOSViewController @@ -82,6 +115,11 @@ return self; } +- (void)loadView +{ + self.view = [[[QIOSDesktopManagerView alloc] init] autorelease]; +} + -(BOOL)shouldAutorotate { // Until a proper orientation and rotation API is in place, we always auto rotate. |