Fixed hotkey_groups shortcuts not being assigned correctly

This commit is contained in:
OpenSauce04 2024-08-26 00:45:51 +01:00 committed by OpenSauce
parent c9ecf00cd6
commit f4e6c2f963

View File

@ -44,13 +44,13 @@ void HotkeyRegistry::LoadHotkeys() {
QShortcut* HotkeyRegistry::GetHotkey(const QString& group, const QString& action, QObject* widget) { QShortcut* HotkeyRegistry::GetHotkey(const QString& group, const QString& action, QObject* widget) {
Hotkey& hk = hotkey_groups[group][action]; Hotkey& hk = hotkey_groups[group][action];
QShortcut* shortcut = hk.shortcuts[widget->objectName()]; const auto widget_name = widget->objectName();
if (!shortcut) { if (!hk.shortcuts[widget_name]) {
shortcut = new QShortcut(hk.keyseq, widget, nullptr, nullptr, hk.context); hk.shortcuts[widget_name] = new QShortcut(hk.keyseq, widget, nullptr, nullptr, hk.context);
} }
return shortcut; return hk.shortcuts[widget_name];
} }
QKeySequence HotkeyRegistry::GetKeySequence(const QString& group, const QString& action) { QKeySequence HotkeyRegistry::GetKeySequence(const QString& group, const QString& action) {