summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms')
-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