Qt: Fix having to press controller buttons twice for menu items (fixes #2143)

This commit is contained in:
Vicki Pfau 2021-06-12 17:07:32 -07:00
parent e1f9099446
commit 74d12585a3
2 changed files with 8 additions and 1 deletions

View File

@ -13,6 +13,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:
- Util: Improve speed of UPS patch loading

View File

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