all repos — mgba @ 36af5fba879fbca71a1c7a54dbfdb378f9ae105a

mGBA Game Boy Advance Emulator

Qt: Fix shortcuts conflicting between views
Jeffrey Pfau jeffrey@endrift.com
Fri, 03 Apr 2015 21:13:24 -0700
commit

36af5fba879fbca71a1c7a54dbfdb378f9ae105a

parent

5da7198d07fe87f8f508567dc83d7f3b6707668c

2 files changed, 7 insertions(+), 3 deletions(-)

jump to
M src/platform/qt/LoadSaveState.cppsrc/platform/qt/LoadSaveState.cpp

@@ -43,6 +43,12 @@ loadState(i + 1);

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) {

@@ -79,9 +85,6 @@ case Qt::Key_7:

case Qt::Key_8: 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:
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -922,6 +922,7 @@

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; }