summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/MainFrm.cpp
diff options
context:
space:
mode:
authorTasuku Suzuki <tasuku.suzuki@qt.io>2018-03-22 17:46:21 +0900
committerTasuku Suzuki <tasuku.suzuki@qt.io>2018-03-26 05:02:20 +0000
commit281b2b91365e9ab9b7c1c87d5a5dcbc250833be1 (patch)
treefce23edf2c608c44c9f3d8b20d6b2307ce164986 /src/Authoring/Studio/MainFrm.cpp
parent1bcb7a5b2d7031933398bc0ec4b84b8d45149063 (diff)
Assign Ctrl+1 to Ctrl+9 to switch camera
Task-number: QT3DS-691 Task-number: QT3DS-692 Change-Id: Iec00f065e85403dbf854a73787e53ab4e202091e Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring/Studio/MainFrm.cpp')
-rw-r--r--src/Authoring/Studio/MainFrm.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Authoring/Studio/MainFrm.cpp b/src/Authoring/Studio/MainFrm.cpp
index 7a6ef638..3cc34da4 100644
--- a/src/Authoring/Studio/MainFrm.cpp
+++ b/src/Authoring/Studio/MainFrm.cpp
@@ -749,6 +749,29 @@ void CMainFrame::OnFileNew()
g_StudioApp.OnFileNew();
}
+void CMainFrame::onCtrlNPressed()
+{
+ static QMap<int, int> key2index {
+ {1, 9}, // Scene Camera View
+ {2, 0}, {3, 1}, // Perspective & Orthographic
+ {4, 2}, {5, 3}, // Top & Bottom
+ {6, 4}, {7, 5}, // Left & Right
+ {8, 6}, {9, 7}, // Front & Back
+ };
+
+ QAction *action = qobject_cast<QAction *>(sender());
+ Q_ASSERT(action);
+ QKeySequence shortcut = action->shortcut();
+ QMapIterator<int, int> i(key2index);
+ while (i.hasNext()) {
+ i.next();
+ QKeySequence keySequence(Qt::CTRL | static_cast<Qt::Key>(Qt::Key_0 + i.key()));
+ if (shortcut.matches(keySequence) == QKeySequence::ExactMatch) {
+ m_ui->m_EditCamerasBar->setCameraIndex(i.value());
+ break;
+ }
+ }
+}
//==============================================================================
/**
@@ -1082,6 +1105,12 @@ void CMainFrame::RegisterGlobalKeyboardShortcuts(CHotKeys *inHotKeys, QWidget *a
QKeySequence(Qt::Key_Q),
CMainFrame::toggleSelectMode);
+ for (int keyN = Qt::Key_1; keyN <= Qt::Key_9; keyN++) {
+ ADD_GLOBAL_SHORTCUT(actionParent,
+ QKeySequence(Qt::CTRL | static_cast<Qt::Key>(keyN)),
+ CMainFrame::onCtrlNPressed);
+ }
+
CTimelineControl *theTimelineControl = GetTimelineControl();
if (theTimelineControl)
theTimelineControl->RegisterGlobalKeyboardShortcuts(inHotKeys, actionParent);