From 0915d073f120f60efcd82c473dbf6d3027421c9b Mon Sep 17 00:00:00 2001 From: Kevin Ottens Date: Fri, 25 May 2012 11:14:11 +0200 Subject: QNX: Implement QQnxScreen::nativeOrientation() Provide a proper version of nativeOrientation(). We use the screen physical size as reported by the device to determine its native orientation. Change-Id: I45b593b0d62436529f89050e98e10b8c9463b6b9 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxscreen.cpp | 9 +++++++++ src/plugins/platforms/qnx/qqnxscreen.h | 2 ++ 2 files changed, 11 insertions(+) (limited to 'src/plugins/platforms/qnx') diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 4a9c49593b..7ec84a47ec 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -63,6 +63,7 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, m_primaryScreen(primaryScreen), m_posted(false), m_keyboardHeight(0), + m_nativeOrientation(Qt::PrimaryOrientation), m_platformContext(0) { qScreenDebug() << Q_FUNC_INFO; @@ -93,6 +94,9 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, if (result != 0) { qFatal("QQnxScreen: failed to query display physical size, errno=%d", errno); } + + m_nativeOrientation = val[0] >= val[1] ? Qt::LandscapeOrientation : Qt::PortraitOrientation; + if (m_currentRotation == 0 || m_currentRotation == 180) m_currentPhysicalSize = m_initialPhysicalSize = QSize(val[0], val[1]); else @@ -152,6 +156,11 @@ qreal QQnxScreen::refreshRate() const return static_cast(displayMode.refresh); } +Qt::ScreenOrientation QQnxScreen::nativeOrientation() const +{ + return m_nativeOrientation; +} + Qt::ScreenOrientation QQnxScreen::orientation() const { Qt::ScreenOrientation orient; diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index e34723c774..c2b7c68e2f 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -70,6 +70,7 @@ public: qreal refreshRate() const; + Qt::ScreenOrientation nativeOrientation() const; Qt::ScreenOrientation orientation() const; bool isPrimaryScreen() const { return m_primaryScreen; } @@ -119,6 +120,7 @@ private: int m_keyboardHeight; QSize m_initialPhysicalSize; QSize m_currentPhysicalSize; + Qt::ScreenOrientation m_nativeOrientation; QRect m_initialGeometry; QRect m_currentGeometry; QPlatformOpenGLContext *m_platformContext; -- cgit v1.2.3