diff options
Diffstat (limited to 'src/Authoring/Studio/MainFrm.cpp')
-rw-r--r-- | src/Authoring/Studio/MainFrm.cpp | 29 |
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); |