From b14be0091031b70581c2d8152d3cbce7f3075e4f Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Fri, 5 Apr 2024 13:07:03 +0300 Subject: [PATCH] UI: Options: Fix App Group Hot Key Shortcuts --- src/ui/form/tray/trayicon.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ui/form/tray/trayicon.cpp b/src/ui/form/tray/trayicon.cpp index 5958b495..fd2a1170 100644 --- a/src/ui/form/tray/trayicon.cpp +++ b/src/ui/form/tray/trayicon.cpp @@ -708,13 +708,17 @@ void TrayIcon::updateActionHotKeys() for (auto action : hotKeyManager()->actions()) { const auto &iniKey = m_actionIniKeys[index]; - QString shortcutText = iniUser()->hotKeyValue(iniKey); + const QString shortcutText = iniUser()->hotKeyValue(iniKey); + QKeySequence shortcut = QKeySequence::fromString(shortcutText); - if (iniKey == HotKey::appGroupModifier) { - shortcutText += "+F" + QString::number(++groupIndex); + if (!shortcut.isEmpty() && iniKey == HotKey::appGroupModifier) { + const QKeyCombination key = shortcut[0]; + + shortcut = Qt::KeyboardModifiers(key & Qt::KeyboardModifierMask) + | (Qt::Key_F1 + groupIndex); + ++groupIndex; } - const QKeySequence shortcut = QKeySequence::fromString(shortcutText); action->setShortcut(shortcut); ++index;