diff --git a/src/lime_qt/hotkeys.cpp b/src/lime_qt/hotkeys.cpp index 32a3ae95a..d81d52e54 100644 --- a/src/lime_qt/hotkeys.cpp +++ b/src/lime_qt/hotkeys.cpp @@ -33,21 +33,24 @@ void HotkeyRegistry::LoadHotkeys() { QKeySequence::fromString(shortcut.shortcut.keyseq, QKeySequence::NativeText); hk.context = static_cast(shortcut.shortcut.context); } - if (hk.shortcut) { - hk.shortcut->disconnect(); - hk.shortcut->setKey(hk.keyseq); + for(auto const& [_, hotkey_shortcut] : hk.shortcuts) { + if (hotkey_shortcut) { + hotkey_shortcut->disconnect(); + hotkey_shortcut->setKey(hk.keyseq); + } } } } QShortcut* HotkeyRegistry::GetHotkey(const QString& group, const QString& action, QObject* widget) { Hotkey& hk = hotkey_groups[group][action]; + QShortcut* shortcut = hk.shortcuts[widget->objectName()]; - if (!hk.shortcut) { - hk.shortcut = new QShortcut(hk.keyseq, widget, nullptr, nullptr, hk.context); + if (!shortcut) { + shortcut = new QShortcut(hk.keyseq, widget, nullptr, nullptr, hk.context); } - return hk.shortcut; + return shortcut; } QKeySequence HotkeyRegistry::GetKeySequence(const QString& group, const QString& action) { diff --git a/src/lime_qt/hotkeys.h b/src/lime_qt/hotkeys.h index 1c10b04a7..639d5db51 100644 --- a/src/lime_qt/hotkeys.h +++ b/src/lime_qt/hotkeys.h @@ -71,7 +71,7 @@ private: struct Hotkey { QKeySequence keyseq; QString controller_keyseq; - QShortcut* shortcut = nullptr; + std::map shortcuts; Qt::ShortcutContext context = Qt::WindowShortcut; };