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>
This commit is contained in:
Paul Olav Tvete 2013-09-12 15:23:31 +02:00 committed by The Qt Project
parent 52e38509c6
commit 07538de8b1
2 changed files with 19 additions and 0 deletions

View File

@ -443,6 +443,23 @@ Qt::ScreenOrientation QScreen::primaryOrientation() const
return d->primaryOrientation; 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 // i must be power of two
static int log2(uint i) static int log2(uint i)
{ {

View File

@ -85,6 +85,7 @@ class Q_GUI_EXPORT QScreen : public QObject
Q_PROPERTY(qreal logicalDotsPerInch READ logicalDotsPerInch NOTIFY logicalDotsPerInchChanged) Q_PROPERTY(qreal logicalDotsPerInch READ logicalDotsPerInch NOTIFY logicalDotsPerInchChanged)
Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY primaryOrientationChanged) Q_PROPERTY(Qt::ScreenOrientation primaryOrientation READ primaryOrientation NOTIFY primaryOrientationChanged)
Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged) Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation NOTIFY orientationChanged)
Q_PROPERTY(Qt::ScreenOrientation nativeOrientation READ nativeOrientation)
Q_PROPERTY(qreal refreshRate READ refreshRate NOTIFY refreshRateChanged) Q_PROPERTY(qreal refreshRate READ refreshRate NOTIFY refreshRateChanged)
public: public:
@ -122,6 +123,7 @@ public:
Qt::ScreenOrientation primaryOrientation() const; Qt::ScreenOrientation primaryOrientation() const;
Qt::ScreenOrientation orientation() const; Qt::ScreenOrientation orientation() const;
Qt::ScreenOrientation nativeOrientation() const;
Qt::ScreenOrientations orientationUpdateMask() const; Qt::ScreenOrientations orientationUpdateMask() const;
void setOrientationUpdateMask(Qt::ScreenOrientations mask); void setOrientationUpdateMask(Qt::ScreenOrientations mask);