summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Roquetto <rafael.roquetto@kdab.com>2012-10-24 11:11:31 -0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-10 00:56:29 +0100
commite706d1d7463d2baae03ede0d3254bc9c2f3ba2c5 (patch)
tree0a71a58169a73066a7c1c106f1763f495f920ad7
parent7f6155a9c1361355d3c9e88a1a8d1a6415857ebc (diff)
downloadqt4-tools-e706d1d7463d2baae03ede0d3254bc9c2f3ba2c5.tar.gz
Fix QWidget support on Playbook
The BPS version provided by the current version of the Playbook OS does not support orientation locking. This patch implements this manually. This patch is not needed in Qt5, since the API has changed. Change-Id: Ibba6fb3437cb392e3ba3d2b1997a178653226131 Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com> Reviewed-by: Bernd Weimer <bweimer@rim.com> Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
-rw-r--r--src/gui/kernel/qwidget.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 2b8ead3d85..ca0d02a8fe 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -135,6 +135,10 @@
#include <bps/navigator.h>
#endif
+#ifdef Q_OS_BLACKBERRY_TABLET
+#include <bps/orientation.h>
+#endif
+
// widget/widget data creation count
//#define QWIDGET_EXTRA_DEBUG
//#define ALIEN_DEBUG
@@ -11023,11 +11027,35 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
if (testAttribute(Qt::WA_AutoOrientation)) {
navigator_rotation_lock(false);
} else {
+#ifdef Q_OS_BLACKBERRY_TABLET
+ const bool portraitLocked = testAttribute(Qt::WA_LockPortraitOrientation);
+
+ orientation_direction_t direction;
+ orientation_get(&direction, 0);
+
+ int rotation = 0;
+
+ switch (direction) {
+ case ORIENTATION_TOP_UP:
+ case ORIENTATION_RIGHT_UP:
+ rotation = portraitLocked ? 90 : 0;
+ break;
+ case ORIENTATION_BOTTOM_UP:
+ case ORIENTATION_LEFT_UP:
+ rotation = portraitLocked ? 270 : 180;
+ break;
+ default:
+ break;
+ }
+
+ navigator_set_orientation(rotation, 0);
+#else
navigator_set_orientation_mode((testAttribute(Qt::WA_LockPortraitOrientation) ?
NAVIGATOR_PORTRAIT : NAVIGATOR_LANDSCAPE), 0);
+#endif // Q_OS_BLACKBERRY_TABLET
navigator_rotation_lock(true);
}
-#endif
+#endif // Q_OS_BLACKBERRY
#ifdef Q_WS_S60
CAknAppUiBase* appUi = static_cast<CAknAppUiBase*>(CEikonEnv::Static()->EikAppUi());