mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix shortcuts conflicting between views
This commit is contained in:
parent
5da7198d07
commit
36af5fba87
|
@ -43,6 +43,12 @@ LoadSaveState::LoadSaveState(GameController* controller, QWidget* parent)
|
|||
m_slots[i]->installEventFilter(this);
|
||||
connect(m_slots[i], &QAbstractButton::clicked, this, [this, i]() { triggerState(i + 1); });
|
||||
}
|
||||
|
||||
QAction* escape = new QAction(this);
|
||||
escape->connect(escape, SIGNAL(triggered()), this, SLOT(close()));
|
||||
escape->setShortcut(QKeySequence("Esc"));
|
||||
escape->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
addAction(escape);
|
||||
}
|
||||
|
||||
void LoadSaveState::setMode(LoadSave mode) {
|
||||
|
@ -80,9 +86,6 @@ bool LoadSaveState::eventFilter(QObject* object, QEvent* event) {
|
|||
case Qt::Key_9:
|
||||
triggerState(static_cast<QKeyEvent*>(event)->key() - Qt::Key_1 + 1);
|
||||
break;
|
||||
case Qt::Key_Escape:
|
||||
close();
|
||||
break;
|
||||
case Qt::Key_Enter:
|
||||
case Qt::Key_Return:
|
||||
triggerState(m_currentFocus + 1);
|
||||
|
|
|
@ -922,6 +922,7 @@ void Window::updateMRU() {
|
|||
QAction* Window::addControlledAction(QMenu* menu, QAction* action, const QString& name) {
|
||||
m_shortcutController->addAction(menu, action, name);
|
||||
menu->addAction(action);
|
||||
action->setShortcutContext(Qt::WidgetShortcut);
|
||||
addAction(action);
|
||||
return action;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue