diff options
Diffstat (limited to 'src/plugins/platforms/uikit/quikitscreen.mm')
-rw-r--r-- | src/plugins/platforms/uikit/quikitscreen.mm | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/plugins/platforms/uikit/quikitscreen.mm b/src/plugins/platforms/uikit/quikitscreen.mm index ae1c7cf..d7d8207 100644 --- a/src/plugins/platforms/uikit/quikitscreen.mm +++ b/src/plugins/platforms/uikit/quikitscreen.mm @@ -40,6 +40,7 @@ ****************************************************************************/ #include "quikitscreen.h" +#include "quikitwindow.h" #include <QtGui/QApplication> @@ -52,8 +53,7 @@ QUIKitScreen::QUIKitScreen(int screenIndex) m_index(screenIndex) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - UIScreen *screen = [[UIScreen screens] objectAtIndex:screenIndex]; - CGRect bounds = [screen bounds]; + CGRect bounds = [uiScreen() bounds]; m_geometry = QRect(bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height); m_format = QImage::Format_ARGB32; @@ -87,4 +87,26 @@ UIScreen *QUIKitScreen::uiScreen() const return [[UIScreen screens] objectAtIndex:m_index]; } +void QUIKitScreen::updateInterfaceOrientation() +{ + CGRect bounds = [uiScreen() bounds]; + switch ([[UIApplication sharedApplication] statusBarOrientation]) { + case UIInterfaceOrientationPortrait: + case UIInterfaceOrientationPortraitUpsideDown: + m_geometry = QRect(bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height);; + break; + case UIInterfaceOrientationLandscapeLeft: + case UIInterfaceOrientationLandscapeRight: + m_geometry = QRect(bounds.origin.x, bounds.origin.y, + bounds.size.height, bounds.size.width); + break; + } + foreach (QWidget *widget, qApp->topLevelWidgets()) { + QUIKitWindow *platformWindow = static_cast<QUIKitWindow *>(widget->platformWindow()); + if (platformWindow && platformWindow->platformScreen() == this) { + platformWindow->updateGeometryAndOrientation(); + } + } +} + QT_END_NAMESPACE |