summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer.qnx@kdab.com>2012-06-06 11:12:25 +0100
committerQt by Nokia <qt-info@nokia.com>2012-06-06 20:17:11 +0200
commit6aa09123df99f94111b60f3117bde992fbbe7dc4 (patch)
tree7b6b68b892b072f00cf2a175aee0545a0177918d
parentc5b742a5f69c0ef85bc0d56f1178692788eb5305 (diff)
QNX: Take nativeOrientation into account for QNX device orientations
Change-Id: Idfe4a5bd9c9638a1f9ae52a7b1def3f869286587 Reviewed-by: Kevin Ottens <kevin.ottens.qnx@kdab.com> Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-rw-r--r--src/plugins/platforms/qnx/qqnxscreen.cpp35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp
index 7ec84a47ec..0b28557998 100644
--- a/src/plugins/platforms/qnx/qqnxscreen.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreen.cpp
@@ -87,7 +87,7 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display,
// Cache size of this display in millimeters. We have to take care of the orientation.
// libscreen always reports the physical size dimensions as width and height in the
- // landscape orientation. Contrary to this, QPlatformScreen::physicalSize() expects the
+ // native orientation. Contrary to this, QPlatformScreen::physicalSize() expects the
// returned dimensions to follow the current orientation.
errno = 0;
result = screen_get_display_property_iv(m_display, SCREEN_PROPERTY_PHYSICAL_SIZE, val);
@@ -97,7 +97,8 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display,
m_nativeOrientation = val[0] >= val[1] ? Qt::LandscapeOrientation : Qt::PortraitOrientation;
- if (m_currentRotation == 0 || m_currentRotation == 180)
+ const int angle = screen()->angleBetween(m_nativeOrientation, orientation());
+ if (angle == 0 || angle == 180)
m_currentPhysicalSize = m_initialPhysicalSize = QSize(val[0], val[1]);
else
m_currentPhysicalSize = m_initialPhysicalSize = QSize(val[1], val[0]);
@@ -164,14 +165,28 @@ Qt::ScreenOrientation QQnxScreen::nativeOrientation() const
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 (m_nativeOrientation == Qt::LandscapeOrientation) {
+ // Landscape devices e.g. PlayBook
+ 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;
+ } else {
+ // Portrait devices e.g. Phones
+ // ###TODO Check these on an actual phone device
+ if (m_currentRotation == 0)
+ orient = Qt::PortraitOrientation;
+ else if (m_currentRotation == 90)
+ orient = Qt::LandscapeOrientation;
+ else if (m_currentRotation == 180)
+ orient = Qt::InvertedPortraitOrientation;
+ else
+ orient = Qt::InvertedLandscapeOrientation;
+ }
qScreenDebug() << Q_FUNC_INFO << "orientation =" << orient;
return orient;
}