1 // checksum 0xa193 version 0x30001
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.
11 #include <QtCore/QCoreApplication>
12 #include "mainwindow.h"
13 #include "ui_mainwindow.h"
15 MainWindow::MainWindow(QWidget *parent)
16 : QMainWindow(parent), ui(new Ui::MainWindow)
19 // QPushButton *goButton;
20 // connect(goButton, SIGNAL(clicked()), this, SLOT(go_slot()));
23 MainWindow::~MainWindow()
28 void MainWindow::setOrientation(ScreenOrientation orientation)
30 #if defined(Q_OS_SYMBIAN)
31 // If the version of Qt on the device is < 4.7.2, that attribute won't work
32 if (orientation != ScreenOrientationAuto) {
33 const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.'));
34 if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) {
35 qWarning("Screen orientation locking only supported with Qt 4.7.2 and above");
39 #endif // Q_OS_SYMBIAN
41 Qt::WidgetAttribute attribute;
42 switch (orientation) {
43 #if QT_VERSION < 0x040702
44 // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
45 case ScreenOrientationLockPortrait:
46 attribute = static_cast<Qt::WidgetAttribute>(128);
48 case ScreenOrientationLockLandscape:
49 attribute = static_cast<Qt::WidgetAttribute>(129);
52 case ScreenOrientationAuto:
53 attribute = static_cast<Qt::WidgetAttribute>(130);
55 #else // QT_VERSION < 0x040702
56 case ScreenOrientationLockPortrait:
57 attribute = Qt::WA_LockPortraitOrientation;
59 case ScreenOrientationLockLandscape:
60 attribute = Qt::WA_LockLandscapeOrientation;
63 case ScreenOrientationAuto:
64 attribute = Qt::WA_AutoOrientation;
66 #endif // QT_VERSION < 0x040702
68 setAttribute(attribute, true);
71 void MainWindow::showExpanded()
75 #elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
82 void MainWindow::on_gobutton_clicked() {
83 qDebug() << "go clicked (not active)";