1 // checksum 0xfd0b version 0x20001
3 This file was generated by the Mobile Qt Application wizard of Qt Creator.
4 MainWindow is a convenience class containing mobile device specific code
5 such as screen orientation handling.
6 It is recommended not to modify this file, since newer versions of Qt Creator
7 may offer an updated version of it.
10 #include "mainwindow.h"
11 #include "ui_mainwindow.h"
13 #include <QtCore/QCoreApplication>
15 #if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK)
20 #endif // Q_OS_SYMBIAN && ORIENTATIONLOCK
22 MainWindow::MainWindow(QWidget *parent)
23 : QMainWindow(parent), ui(new Ui::MainWindow)
28 MainWindow::~MainWindow()
33 void MainWindow::setOrientation(ScreenOrientation orientation)
36 if (orientation != ScreenOrientationAuto) {
37 #if defined(ORIENTATIONLOCK)
38 const CAknAppUiBase::TAppUiOrientation uiOrientation =
39 (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait
40 : CAknAppUi::EAppUiOrientationLandscape;
41 CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi());
44 appUi->SetOrientationL(uiOrientation);
47 #else // ORIENTATIONLOCK
48 qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation.");
49 #endif // ORIENTATIONLOCK
51 #elif defined(Q_WS_MAEMO_5)
52 Qt::WidgetAttribute attribute;
53 switch (orientation) {
54 case ScreenOrientationLockPortrait:
55 attribute = Qt::WA_Maemo5PortraitOrientation;
57 case ScreenOrientationLockLandscape:
58 attribute = Qt::WA_Maemo5LandscapeOrientation;
60 case ScreenOrientationAuto:
62 attribute = Qt::WA_Maemo5AutoOrientation;
65 setAttribute(attribute, true);
67 Q_UNUSED(orientation);
68 #endif // Q_OS_SYMBIAN
71 void MainWindow::showExpanded()
75 #elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)