| 28 | } |
| 29 | |
| 30 | void ShortcutManager::setBinding(const QString& actionId, const QKeySequence& key) |
| 31 | { |
| 32 | auto* a = action(actionId); |
| 33 | if (!a) return; |
| 34 | |
| 35 | // Clear any existing binding on this key (prevent conflicts) |
| 36 | if (!key.isEmpty()) { |
| 37 | for (auto& other : m_actions) { |
| 38 | if (other.id != actionId && other.currentKey == key) |
| 39 | other.currentKey = QKeySequence(); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | a->currentKey = key; |
| 44 | saveBindings(); |
| 45 | emit bindingsChanged(); |
| 46 | } |
| 47 | |
| 48 | void ShortcutManager::clearBinding(const QString& actionId) |
| 49 | { |