From 9be17aa4686e208fe03debd2595d6da86b42aef8 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Mon, 21 May 2012 11:19:14 +0100 Subject: QNX: Implement the QPlatformScreen::orientation() function Also removed some invalid TODO comments. Change-Id: I470a9a6538ce10a3a14df14faa641d7be7f18a74 Reviewed-by: Kevin Ottens Reviewed-by: Giuseppe D'Angelo --- src/plugins/platforms/qnx/qqnxscreen.cpp | 19 +++++++++++++++++-- src/plugins/platforms/qnx/qqnxscreen.h | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index ac0d552d90..8bdc4974f1 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -65,7 +65,6 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, qDebug() << Q_FUNC_INFO; #endif // Cache initial orientation of this display - // TODO: use ORIENTATION environment variable? errno = 0; int result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_ROTATION, &m_initialRotation); if (result != 0) { @@ -74,7 +73,6 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display, m_currentRotation = m_initialRotation; // Cache size of this display in pixels - // TODO: use WIDTH and HEIGHT environment variables? errno = 0; int val[2]; result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_SIZE, val); @@ -137,6 +135,23 @@ int QQnxScreen::depth() const return defaultDepth(); } +Qt::ScreenOrientation QQnxScreen::orientation() const +{ + Qt::ScreenOrientation orient; + if (m_currentRotation == 0) + orient = Qt::LandscapeOrientation; + else if (m_currentRotation == 90) + orient = Qt::PortraitOrientation; + else if (m_currentRotation == 180) + orient = Qt::InvertedLandscapeOrientation; + else + orient = Qt::InvertedPortraitOrientation; +#if defined(QQNXSCREEN_DEBUG) + qDebug() << Q_FUNC_INFO << "orientation =" << orient; +#endif + return orient; +} + /*! Check if the supplied angles are perpendicular to each other. */ diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index 4a13946ec3..e7866b5136 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -68,6 +68,8 @@ public: QImage::Format format() const { return (depth() == 32) ? QImage::Format_RGB32 : QImage::Format_RGB16; } QSizeF physicalSize() const { return m_currentPhysicalSize; } + Qt::ScreenOrientation orientation() const; + bool isPrimaryScreen() const { return m_primaryScreen; } int rotation() const { return m_currentRotation; } -- cgit v1.2.3