summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/qmlviewer/qmlviewer.cpp13
-rw-r--r--tools/qmlviewer/qmlviewer.h1
2 files changed, 14 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())
diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h
index 39bedc3..3b14d39 100644
--- a/tools/qmlviewer/qmlviewer.h
+++ b/tools/qmlviewer/qmlviewer.h
@@ -132,6 +132,7 @@ private slots:
void adjustSizeSlot();
void setPortrait();
void setLandscape();
+ void toggleOrientation();
void startNetwork();
void toggleFullScreen();
void unpackWgt();