12345678910111213141516171819202122232425262728293031 |
- #include "mapwidget.h"
- #include "ui_mapwidget.h"
- #include <QtGui>
- MapWidget::MapWidget(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::MapWidget)
- {
- ui->setupUi(this);
- //setAttribute(Qt::WA_Maemo5PortraitOrientation, true);
- setAttribute(Qt::WA_Maemo5AutoOrientation, true);
- connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(orientationChanged()));
- }
- MapWidget::~MapWidget()
- {
- delete ui;
- }
- void MapWidget::orientationChanged()
- {
- QRect screenGeometry = QApplication::desktop()->screenGeometry();
- if (screenGeometry.width() > screenGeometry.height())
- ui->label->setText("<p align=\"center\">In Landscape Mode</p>");
- else
- ui->label->setText("<p align=\"center\">In Portrait Mode</p>");
- }
|