summaryrefslogtreecommitdiffhomepage
path: root/opentrack/shortcuts.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-10-21 10:10:56 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-10-21 10:29:17 +0200
commitf6d8fbbf3f4bc6984020de776285a38ad45c3631 (patch)
tree8d9b297e09de1053878a01ee1bf198803daa7967 /opentrack/shortcuts.cpp
parenta1ce590fb13ce34a3051f619f0d9cdbc1d2dffa5 (diff)
workaround qxt-mini "shortcut failed to unregister"
Diffstat (limited to 'opentrack/shortcuts.cpp')
-rw-r--r--opentrack/shortcuts.cpp16
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