mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Allow display plugin switching by keyboard
This commit is contained in:
parent
35aa074955
commit
80e2025ebf
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