diff --git a/src/autotype/ShortcutWidget.cpp b/src/autotype/ShortcutWidget.cpp index 9477131aa..11e6ad9a5 100644 --- a/src/autotype/ShortcutWidget.cpp +++ b/src/autotype/ShortcutWidget.cpp @@ -56,6 +56,14 @@ void ShortcutWidget::setShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers) } } +void ShortcutWidget::resetShortcut() +{ + m_key = static_cast(0); + m_modifiers = 0; + m_locked = false; + autoType()->unregisterGlobalShortcut(); +} + void ShortcutWidget::keyPressEvent(QKeyEvent* event) { keyEvent(event); @@ -106,15 +114,14 @@ void ShortcutWidget::keyEvent(QKeyEvent* event) setShortcut(key, modifiers); } else { - m_locked = false; + resetShortcut(); setStyleSheet(""); displayShortcut(key, modifiers); } } else { if (m_locked) { - m_locked = false; - m_key = static_cast(0); + resetShortcut(); setStyleSheet(""); } diff --git a/src/autotype/ShortcutWidget.h b/src/autotype/ShortcutWidget.h index 028dd8300..8dba02b34 100644 --- a/src/autotype/ShortcutWidget.h +++ b/src/autotype/ShortcutWidget.h @@ -39,6 +39,7 @@ protected: private: void keyEvent(QKeyEvent* event); void displayShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers); + void resetShortcut(); Qt::Key m_key; Qt::KeyboardModifiers m_modifiers;