2010-09-13 11:20:13 +02:00
|
|
|
#include "mainwindow.h"
|
|
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QCoreApplication>
|
2010-09-13 11:20:13 +02:00
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
|
|
|
: QMainWindow(parent), ui(new Ui::MainWindow)
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
|
{
|
|
|
|
|
delete ui;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-01 17:03:46 +01:00
|
|
|
void MainWindow::setOrientation(ScreenOrientation orientation)
|
2010-09-13 11:20:13 +02:00
|
|
|
{
|
|
|
|
|
Qt::WidgetAttribute attribute;
|
|
|
|
|
switch (orientation) {
|
2011-02-02 13:41:22 +01:00
|
|
|
#if QT_VERSION < 0x040702
|
|
|
|
|
// Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes
|
2010-11-01 17:03:46 +01:00
|
|
|
case ScreenOrientationLockPortrait:
|
2011-02-02 13:41:22 +01:00
|
|
|
attribute = static_cast<Qt::WidgetAttribute>(128);
|
2010-09-13 11:20:13 +02:00
|
|
|
break;
|
2010-11-01 17:03:46 +01:00
|
|
|
case ScreenOrientationLockLandscape:
|
2011-02-02 13:41:22 +01:00
|
|
|
attribute = static_cast<Qt::WidgetAttribute>(129);
|
2010-09-13 11:20:13 +02:00
|
|
|
break;
|
2011-02-02 13:41:22 +01:00
|
|
|
default:
|
2010-11-01 17:03:46 +01:00
|
|
|
case ScreenOrientationAuto:
|
2011-02-02 13:41:22 +01:00
|
|
|
attribute = static_cast<Qt::WidgetAttribute>(130);
|
|
|
|
|
break;
|
|
|
|
|
#else // QT_VERSION < 0x040702
|
|
|
|
|
case ScreenOrientationLockPortrait:
|
|
|
|
|
attribute = Qt::WA_LockPortraitOrientation;
|
|
|
|
|
break;
|
|
|
|
|
case ScreenOrientationLockLandscape:
|
|
|
|
|
attribute = Qt::WA_LockLandscapeOrientation;
|
|
|
|
|
break;
|
2010-09-13 11:20:13 +02:00
|
|
|
default:
|
2011-02-02 13:41:22 +01:00
|
|
|
case ScreenOrientationAuto:
|
|
|
|
|
attribute = Qt::WA_AutoOrientation;
|
2010-09-13 11:20:13 +02:00
|
|
|
break;
|
2011-02-02 13:41:22 +01:00
|
|
|
#endif // QT_VERSION < 0x040702
|
|
|
|
|
};
|
2010-09-13 11:20:13 +02:00
|
|
|
setAttribute(attribute, true);
|
|
|
|
|
}
|
2010-11-01 19:19:32 +01:00
|
|
|
|
|
|
|
|
void MainWindow::showExpanded()
|
|
|
|
|
{
|
2012-08-22 13:27:25 +02:00
|
|
|
#if defined(Q_WS_SIMULATOR)
|
2010-11-01 19:19:32 +01:00
|
|
|
showFullScreen();
|
2011-01-14 15:45:53 +01:00
|
|
|
#elif defined(Q_WS_MAEMO_5)
|
2010-11-01 19:19:32 +01:00
|
|
|
showMaximized();
|
|
|
|
|
#else
|
|
|
|
|
show();
|
|
|
|
|
#endif
|
|
|
|
|
}
|