summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@digia.com>2013-09-12 15:23:31 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-13 19:08:27 +0200
commit07538de8b105b92e4b665f5d8c59852ab894f94b (patch)
treebd2701c290e1b7ad3e5751c386a82161851df7c4 /src/gui
parent52e38509c6c57395e2ebc22e3ffb5b298c1671c5 (diff)
Make nativeOrientation available in the public API
The QtSensors module defines the coordinate system relative to QPlatformScreen::nativeOrientation(). However, that is not part of the public Qt API. Task-number: QTBUG-32144 Change-Id: I6941c5b8589219064749f18880775b803f23fbbd Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qscreen.cpp17
-rw-r--r--src/gui/kernel/qscreen.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index 2168cdf43a..558eca6b1d 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -443,6 +443,23 @@ Qt::ScreenOrientation QScreen::primaryOrientation() const
return d->primaryOrientation;
}
+/*!
+ \property QScreen::nativeOrientation
+ \brief the native screen orientation
+ \since 5.2
+
+ The native orientation of the screen is the orientation where the logo
+ sticker of the device appears the right way up, or Qt::PrimaryOrientation
+ if the platform does not support this functionality.
+
+ The native orientation is a property of the hardware, and does not change.
+*/
+Qt::ScreenOrientation QScreen::nativeOrientation() const
+{
+ Q_D(const QScreen);
+ return d->platformScreen->nativeOrientation();
+}
+
// i must be power of two
static int log2(uint i)
{
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 9fe4379646..bdd5939657 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -85,6 +85,7 @@ class Q_GUI_EXPORT QScreen : public QObject
Q_PROPERTY(qreal logicalDotsPerInch READ logicalDotsPerInch NOTIFY logicalDotsPerInchChanged)
Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY primaryOrientationChanged)
Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
+ Q_PROPERTY(Qt::ScreenOrientation nativeOrientation READ nativeOrientation)
Q_PROPERTY(qreal refreshRate READ refreshRate NOTIFY refreshRateChanged)
public:
@@ -122,6 +123,7 @@ public:
Qt::ScreenOrientation primaryOrientation() const;
Qt::ScreenOrientation orientation() const;
+ Qt::ScreenOrientation nativeOrientation() const;
Qt::ScreenOrientations orientationUpdateMask() const;
void setOrientationUpdateMask(Qt::ScreenOrientations mask);