Qt: Fix shortcuts conflicting between views
Jeffrey Pfau jeffrey@endrift.com
Fri, 03 Apr 2015 21:13:24 -0700
2 files changed,
7 insertions(+),
3 deletions(-)
M
src/platform/qt/LoadSaveState.cpp
→
src/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.cpp
→
src/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; }