summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget.cpp
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2011-01-25 14:29:41 (GMT)
committermread <qt-info@nokia.com>2011-01-27 17:26:33 (GMT)
commite0489b905d6a31c7a904ca2b62a1e60cd12dba4f (patch)
tree6529b0c300ac36301c23b31648adb940aae15a11 /src/gui/kernel/qwidget.cpp
parent4ec245a3e75470186557d00b2383af3872a720b0 (diff)
downloadQt-e0489b905d6a31c7a904ca2b62a1e60cd12dba4f.zip
Qt-e0489b905d6a31c7a904ca2b62a1e60cd12dba4f.tar.gz
Qt-e0489b905d6a31c7a904ca2b62a1e60cd12dba4f.tar.bz2
Orientation control implementation for Symbian
This used the orientation control QWidget attributes API from maemo5, and provides a simple implementation for Symbian. The essense of the implementation is that the latest setting of one of these QWidget orientation attributes will set the orientation for the whole app. Testing the attributes will return only the last attribute set, it will not return the app orientation state. A new task, QTBUG-16972, has been created to provide a more comprehensive implementation in the future. This may provide a more effective emulation of the maemo5 behaviour, or may incorporate further reaching concepts for QML rotations. Task-number: QTBUG-11785 Reviewed-by: Shane Kearns
Diffstat (limited to 'src/gui/kernel/qwidget.cpp')
-rw-r--r--src/gui/kernel/qwidget.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 9a76b0a..e542a59 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -124,6 +124,10 @@
#include "qtabwidget.h" // Needed in inTabWidget()
#endif // QT_KEYPAD_NAVIGATION
+#ifdef Q_WS_S60
+#include <aknappui.h>
+#endif
+
// widget/widget data creation count
//#define QWIDGET_EXTRA_DEBUG
//#define ALIEN_DEBUG
@@ -10810,6 +10814,42 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
d->registerTouchWindow();
#endif
break;
+ case Qt::WA_LockPortraitOrientation:
+ case Qt::WA_LockLandscapeOrientation:
+ case Qt::WA_AutoOrientation: {
+ const Qt::WidgetAttribute orientations[3] = {
+ Qt::WA_LockPortraitOrientation,
+ Qt::WA_LockLandscapeOrientation,
+ Qt::WA_AutoOrientation
+ };
+
+ if (on) {
+ // We can only have one of these set at a time
+ for (int i = 0; i < 3; ++i) {
+ if (orientations[i] != attribute)
+ setAttribute_internal(orientations[i], false, data, d);
+ }
+ }
+
+#ifdef Q_WS_S60
+ CAknAppUiBase* appUi = static_cast<CAknAppUiBase*>(CEikonEnv::Static()->EikAppUi());
+ const CAknAppUiBase::TAppUiOrientation s60orientations[] = {
+ CAknAppUiBase::EAppUiOrientationPortrait,
+ CAknAppUiBase::EAppUiOrientationLandscape,
+ CAknAppUiBase::EAppUiOrientationAutomatic
+ };
+ CAknAppUiBase::TAppUiOrientation s60orientation = CAknAppUiBase::EAppUiOrientationUnspecified;
+ for (int i = 0; i < 3; ++i) {
+ if (testAttribute(orientations[i])) {
+ s60orientation = s60orientations[i];
+ break;
+ }
+ }
+ QT_TRAP_THROWING(appUi->SetOrientationL(s60orientation));
+ S60->orientationSet = true;
+#endif
+ break;
+ }
default:
break;
}