History

Allow display plugin switching by keyboard

Bradley Austin Davis committed 10 years ago

Commit 80e20251 parent 35aa0741 file · +22 −0Browse files

Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application.cpp+22−0
@@ -1899,6 +1899,28 @@ void Application::keyPressEvent(QKeyEvent* event) { · 1898 unmodified lines
1899 }1899 }
1900 break;1900 break;
1901 1901
1902 case Qt::Key_1:
1903 case Qt::Key_2:
1904 case Qt::Key_3:
1905 case Qt::Key_4:
1906 case Qt::Key_5:
1907 case Qt::Key_6:
1908 case Qt::Key_7:
1909 if (isMeta || isOption) {
1910 unsigned int index = static_cast<unsigned int>(event->key() - Qt::Key_1);
1911 auto displayPlugins = PluginManager::getInstance()->getDisplayPlugins();
1912 if (index <= displayPlugins.size()) {
1913 auto targetPlugin = displayPlugins.at(index);
1914 QString targetName = targetPlugin->getName();
1915 auto menu = Menu::getInstance();
1916 QAction* action = menu->getActionForOption(targetName);
1917 if (action && !action->isChecked()) {
1918 action->trigger();
1919 }
1920 }
1921 }
1922 break;
1923
1902 case Qt::Key_X:1924 case Qt::Key_X:
1903 if (isShifted && isMeta) {1925 if (isShifted && isMeta) {
1904 auto offscreenUi = DependencyManager::get<OffscreenUi>();1926 auto offscreenUi = DependencyManager::get<OffscreenUi>();