Introduce nativeOrientation() to QPlatformScreen
authorKevin Ottens <kevin.ottens.qnx@kdab.com>
Fri, 25 May 2012 08:30:52 +0000 (10:30 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 5 Jun 2012 14:01:29 +0000 (16:01 +0200)
Now QPlatformScreen has a nativeOrientation() method which default
implementation return Qt::PrimaryOrientation. Its purpose is to return
the native orientation of the device (e.g. when the device logo is right
up).

Only the QPA backend can know for sure what this native orientation is,
so allow QPA backends to override it with a finer result.

Change-Id: I3bef14acb6b8568e64398ff919d9cb4461a2c9cc
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/gui/kernel/qplatformscreen.h
src/gui/kernel/qplatformscreen_qpa.cpp

index d0c4a16..4baf0f6 100644 (file)
@@ -101,6 +101,7 @@ public:
 
     virtual qreal refreshRate() const;
 
+    virtual Qt::ScreenOrientation nativeOrientation() const;
     virtual Qt::ScreenOrientation orientation() const;
 
     virtual QWindow *topLevelAt(const QPoint &point) const;
index e40550a..fdb5d32 100644 (file)
@@ -172,6 +172,18 @@ qreal QPlatformScreen::refreshRate() const
 }
 
 /*!
+    Reimplement this function in subclass to return the native orientation
+    of the screen, e.g. the orientation where the logo sticker of the device
+    appears the right way up.
+
+    The default implementation returns Qt::PrimaryOrientation.
+*/
+Qt::ScreenOrientation QPlatformScreen::nativeOrientation() const
+{
+    return Qt::PrimaryOrientation;
+}
+
+/*!
     Reimplement this function in subclass to return the current orientation
     of the screen, for example based on accelerometer data to determine
     the device orientation.