Skip to content

Commit

Permalink
Qt: Fix having to press controller buttons twice for menu items (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
endrift committed Jun 13, 2021
1 parent d85589b commit b97f971
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -21,6 +21,7 @@ Other fixes:
- Qt: Fix infrequent deadlock when using sync to video
- Qt: Fix applying savetype-only overrides
- Qt: Fix crash in sprite view for partially out-of-bounds sprites (fixes mgba.io/i/2165)
- Qt: Fix having to press controller buttons twice for menu items (fixes mgba.io/i/2143)
- Util: Fix loading UPS patches that affect the last byte of the file
Misc:
- Core: Suspend runloop when a core crashes
Expand Down
8 changes: 7 additions & 1 deletion src/platform/qt/ActionMapper.cpp
Expand Up @@ -87,7 +87,13 @@ void ActionMapper::rebuildMenu(const QString& menu, QMenu* qmenu, QWidget* conte
}
});
QObject::connect(action, &Action::enabled, qaction, &QAction::setEnabled);
QObject::connect(action, &Action::activated, qaction, &QAction::setChecked);
QObject::connect(action, &Action::activated, [qaction, action](bool active) {
if (qaction->isCheckable()) {
qaction->setChecked(active);
} else if (active) {
action->setActive(false);
}
});
QObject::connect(action, &Action::destroyed, qaction, &QAction::deleteLater);
if (shortcut) {
QObject::connect(shortcut, &Shortcut::shortcutChanged, qaction, [qaction](int shortcut) {
Expand Down

0 comments on commit b97f971

Please sign in to comment.