diff --git a/apps/opencs/model/prefs/modifiersetting.cpp b/apps/opencs/model/prefs/modifiersetting.cpp index 73c8343a3..12a4b5d80 100644 --- a/apps/opencs/model/prefs/modifiersetting.cpp +++ b/apps/opencs/model/prefs/modifiersetting.cpp @@ -76,7 +76,32 @@ namespace CSMPrefs const size_t BlacklistSize = sizeof(Blacklist) / sizeof(int); if (!mEditorActive) + { + if (value == Qt::RightButton) + { + // Clear modifier + QKeySequence sequence; + int modifier = 0; + + State::get().getShortcutManager().getSequence(getKey(), sequence, modifier); + + modifier = 0; + State::get().getShortcutManager().setSequence(getKey(), sequence, modifier); + + // Store + { + std::string value = State::get().getShortcutManager().convertToString(sequence, modifier); + + QMutexLocker lock(getMutex()); + getValues().setString(getKey(), getParent()->getKey(), value); + } + + // Update button + mButton->setText(""); + } + return false; + } // Handle blacklist for (size_t i = 0; i < BlacklistSize; ++i) diff --git a/apps/opencs/model/prefs/shortcutsetting.cpp b/apps/opencs/model/prefs/shortcutsetting.cpp index 07f9c8052..c98384695 100644 --- a/apps/opencs/model/prefs/shortcutsetting.cpp +++ b/apps/opencs/model/prefs/shortcutsetting.cpp @@ -108,7 +108,32 @@ namespace CSMPrefs const size_t BlacklistSize = sizeof(Blacklist) / sizeof(int); if (!mEditorActive) + { + if (value == Qt::RightButton && !active) + { + // Clear sequence + QKeySequence sequence; + int modifier = 0; + + State::get().getShortcutManager().getSequence(getKey(), sequence, modifier); + + sequence = QKeySequence(0, 0, 0, 0); + State::get().getShortcutManager().setSequence(getKey(), sequence, modifier); + + // Store + { + std::string value = State::get().getShortcutManager().convertToString(sequence, modifier); + + QMutexLocker lock(getMutex()); + getValues().setString(getKey(), getParent()->getKey(), value); + } + + // Update button + mButton->setText(""); + } + return false; + } // Handle blacklist for (size_t i = 0; i < BlacklistSize; ++i)