mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 01:24:03 +02:00
Merge pull request #7375 from jherico/display_switch_shortcut
Allow display plugin switching by keyboard
This commit is contained in:
commit
10a0bac90b
1 changed files with 22 additions and 0 deletions
|
@ -1899,6 +1899,28 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
|||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_1:
|
||||
case Qt::Key_2:
|
||||
case Qt::Key_3:
|
||||
case Qt::Key_4:
|
||||
case Qt::Key_5:
|
||||
case Qt::Key_6:
|
||||
case Qt::Key_7:
|
||||
if (isMeta || isOption) {
|
||||
unsigned int index = static_cast<unsigned int>(event->key() - Qt::Key_1);
|
||||
auto displayPlugins = PluginManager::getInstance()->getDisplayPlugins();
|
||||
if (index <= displayPlugins.size()) {
|
||||
auto targetPlugin = displayPlugins.at(index);
|
||||
QString targetName = targetPlugin->getName();
|
||||
auto menu = Menu::getInstance();
|
||||
QAction* action = menu->getActionForOption(targetName);
|
||||
if (action && !action->isChecked()) {
|
||||
action->trigger();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_X:
|
||||
if (isShifted && isMeta) {
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
|
|
Loading…
Reference in a new issue