summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2012-11-15 14:02:04 +0100
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-02-27 23:55:45 +0100
commit72f66a8ee57ad3865d25e0157179d042a474cfff (patch)
treefdc9bf59b77286f4f7f2825dd913058b20cde26e /src
parent92252bcb93b2e8ba8cefeadf8cc0330c8ff1c47b (diff)
iOS: add function convertToUIOrientation
Change-Id: I6145121d49eb3f5bab3f2a1ba57c779ec0b01023 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/ios/qiosorientationlistener.h1
-rw-r--r--src/plugins/platforms/ios/qiosorientationlistener.mm22
2 files changed, 23 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosorientationlistener.h b/src/plugins/platforms/ios/qiosorientationlistener.h
index c7b481a03a..9d2e902ce1 100644
--- a/src/plugins/platforms/ios/qiosorientationlistener.h
+++ b/src/plugins/platforms/ios/qiosorientationlistener.h
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
class QIOSScreen;
Qt::ScreenOrientation convertToQtOrientation(UIDeviceOrientation uiDeviceOrientation);
+UIDeviceOrientation convertToUIOrientation(Qt::ScreenOrientation qtOrientation);
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qiosorientationlistener.mm b/src/plugins/platforms/ios/qiosorientationlistener.mm
index 626e43129b..264b77f14f 100644
--- a/src/plugins/platforms/ios/qiosorientationlistener.mm
+++ b/src/plugins/platforms/ios/qiosorientationlistener.mm
@@ -69,6 +69,28 @@ Qt::ScreenOrientation convertToQtOrientation(UIDeviceOrientation uiDeviceOrienta
return qtOrientation;
}
+UIDeviceOrientation convertToUIOrientation(Qt::ScreenOrientation qtOrientation)
+{
+ UIDeviceOrientation uiOrientation;
+ switch (qtOrientation) {
+ case Qt::LandscapeOrientation:
+ uiOrientation = UIDeviceOrientationLandscapeRight;
+ break;
+ case Qt::InvertedLandscapeOrientation:
+ uiOrientation = UIDeviceOrientationLandscapeLeft;
+ break;
+ case Qt::InvertedPortraitOrientation:
+ uiOrientation = UIDeviceOrientationPortraitUpsideDown;
+ break;
+ case Qt::PrimaryOrientation:
+ case Qt::PortraitOrientation:
+ default:
+ uiOrientation = UIDeviceOrientationPortrait;
+ break;
+ }
+ return uiOrientation;
+}
+
QT_END_NAMESPACE
@implementation QIOSOrientationListener