summaryrefslogtreecommitdiffstats
path: root/tools/qmlviewer/qmlviewer.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-01-14 08:29:49 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-01-14 08:29:49 (GMT)
commit4aa21210f946476ca36c9c8e83dc13fc25ed4c2e (patch)
treef80af57efc85c3e56d9f1ef53b812b82fc54eae1 /tools/qmlviewer/qmlviewer.cpp
parentf4f858578afe507ecfebd807f28bad025a85e1b9 (diff)
downloadQt-4aa21210f946476ca36c9c8e83dc13fc25ed4c2e.zip
Qt-4aa21210f946476ca36c9c8e83dc13fc25ed4c2e.tar.gz
Qt-4aa21210f946476ca36c9c8e83dc13fc25ed4c2e.tar.bz2
Add toggle orientation option
Diffstat (limited to 'tools/qmlviewer/qmlviewer.cpp')
-rw-r--r--tools/qmlviewer/qmlviewer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp
index 21288c4..2d0daea 100644
--- a/tools/qmlviewer/qmlviewer.cpp
+++ b/tools/qmlviewer/qmlviewer.cpp
@@ -540,6 +540,13 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu)
QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties"));
QActionGroup *orientation = new QActionGroup(parent);
+
+ QAction *toggleOrientation = new QAction(tr("&Toggle Orientation"), parent);
+ toggleOrientation->setCheckable(true);
+ toggleOrientation->setShortcut(QKeySequence("Ctrl+T"));
+ settingsMenu->addAction(toggleOrientation);
+ connect(toggleOrientation, SIGNAL(triggered()), this, SLOT(toggleOrientation()));
+
orientation->setExclusive(true);
portraitOrientation = new QAction(tr("orientation: Portrait"), parent);
portraitOrientation->setCheckable(true);
@@ -598,6 +605,12 @@ void QmlViewer::setLandscape()
landscapeOrientation->setChecked(true);
}
+void QmlViewer::toggleOrientation()
+{
+ qWarning("HELLO");
+ DeviceOrientation::instance()->setOrientation(DeviceOrientation::instance()->orientation()==DeviceOrientation::Portrait?DeviceOrientation::Landscape:DeviceOrientation::Portrait);
+}
+
void QmlViewer::toggleFullScreen()
{
if (isFullScreen())