diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-10-21 10:10:56 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-10-21 10:29:17 +0200 |
commit | f6d8fbbf3f4bc6984020de776285a38ad45c3631 (patch) | |
tree | 8d9b297e09de1053878a01ee1bf198803daa7967 /opentrack/shortcuts.cpp | |
parent | a1ce590fb13ce34a3051f619f0d9cdbc1d2dffa5 (diff) |
workaround qxt-mini "shortcut failed to unregister"
Diffstat (limited to 'opentrack/shortcuts.cpp')
-rw-r--r-- | opentrack/shortcuts.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp index 0a3d7e0d..d1cfa503 100644 --- a/opentrack/shortcuts.cpp +++ b/opentrack/shortcuts.cpp @@ -128,16 +128,18 @@ void KeybindingWorker::run() { Sleep(25); } } - -#else #endif void Shortcuts::bind_keyboard_shortcut(K &key, key_opts& k) { #if !defined(_WIN32) - key.setShortcut(QKeySequence::fromString("")); - key.setDisabled(); const int idx = k.key_index; + if (!key) + key = std::make_shared<QxtGlobalShortcut>(); + else { + key->setEnabled(false); + key->setShortcut(QKeySequence::UnknownKey); + } if (idx > 0) { QString seq(global_key_sequences.value(idx, "")); @@ -149,10 +151,8 @@ void Shortcuts::bind_keyboard_shortcut(K &key, key_opts& k) seq = "Alt+" + seq; if (k.ctrl) seq = "Ctrl+" + seq; - key.setShortcut(QKeySequence::fromString(seq, QKeySequence::PortableText)); - key.setEnabled(); - } else { - key.setDisabled(); + key->setShortcut(QKeySequence::fromString(seq, QKeySequence::PortableText)); + key->setEnabled(); } } #else |