mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Add ability to clear shortcut/modifier setting with right click.
This commit is contained in:
parent
12db6d2114
commit
b685c0ce6c
2 changed files with 50 additions and 0 deletions
|
@ -76,7 +76,32 @@ namespace CSMPrefs
|
||||||
const size_t BlacklistSize = sizeof(Blacklist) / sizeof(int);
|
const size_t BlacklistSize = sizeof(Blacklist) / sizeof(int);
|
||||||
|
|
||||||
if (!mEditorActive)
|
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;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle blacklist
|
// Handle blacklist
|
||||||
for (size_t i = 0; i < BlacklistSize; ++i)
|
for (size_t i = 0; i < BlacklistSize; ++i)
|
||||||
|
|
|
@ -108,7 +108,32 @@ namespace CSMPrefs
|
||||||
const size_t BlacklistSize = sizeof(Blacklist) / sizeof(int);
|
const size_t BlacklistSize = sizeof(Blacklist) / sizeof(int);
|
||||||
|
|
||||||
if (!mEditorActive)
|
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;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle blacklist
|
// Handle blacklist
|
||||||
for (size_t i = 0; i < BlacklistSize; ++i)
|
for (size_t i = 0; i < BlacklistSize; ++i)
|
||||||
|
|
Loading…
Reference in a new issue