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);
|
m_slots[i]->installEventFilter(this);
|
||||||
connect(m_slots[i], &QAbstractButton::clicked, this, [this, i]() { triggerState(i + 1); });
|
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) {
|
void LoadSaveState::setMode(LoadSave mode) {
|
||||||
|
@ -80,9 +86,6 @@ bool LoadSaveState::eventFilter(QObject* object, QEvent* event) {
|
||||||
case Qt::Key_9:
|
case Qt::Key_9:
|
||||||
triggerState(static_cast<QKeyEvent*>(event)->key() - Qt::Key_1 + 1);
|
triggerState(static_cast<QKeyEvent*>(event)->key() - Qt::Key_1 + 1);
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Escape:
|
|
||||||
close();
|
|
||||||
break;
|
|
||||||
case Qt::Key_Enter:
|
case Qt::Key_Enter:
|
||||||
case Qt::Key_Return:
|
case Qt::Key_Return:
|
||||||
triggerState(m_currentFocus + 1);
|
triggerState(m_currentFocus + 1);
|
||||||
|
|
|
@ -922,6 +922,7 @@ void Window::updateMRU() {
|
||||||
QAction* Window::addControlledAction(QMenu* menu, QAction* action, const QString& name) {
|
QAction* Window::addControlledAction(QMenu* menu, QAction* action, const QString& name) {
|
||||||
m_shortcutController->addAction(menu, action, name);
|
m_shortcutController->addAction(menu, action, name);
|
||||||
menu->addAction(action);
|
menu->addAction(action);
|
||||||
|
action->setShortcutContext(Qt::WidgetShortcut);
|
||||||
addAction(action);
|
addAction(action);
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue