From 5ca330e1fd5890ad4504abd5c63f2802e0d2bb87 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 25 Jul 2015 03:23:29 +0200 Subject: shortcuts: linux work --- opentrack/shortcuts.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'opentrack') diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp index 190c4003..56071418 100644 --- a/opentrack/shortcuts.cpp +++ b/opentrack/shortcuts.cpp @@ -125,12 +125,18 @@ void KeybindingWorker::run() { void Shortcuts::bind_keyboard_shortcut(K &key, key_opts& k) { #if !defined(_WIN32) - key->setEnabled(false); - key->setShortcut(QKeySequence::UnknownKey); + + if (key) + { + key->setEnabled(false); + key->setShortcut(QKeySequence::UnknownKey); + } + + key = std::make_shared(); if (k.keycode) { - key->setShortcut(Qt::KeySequence(k.keycode)); + key->setShortcut(QKeySequence(k.keycode)); key->setEnabled(); } } @@ -144,8 +150,8 @@ void Shortcuts::bind_keyboard_shortcut(K &key, key_opts& k) key.alt = !!(mods & Qt::AltModifier); key.ctrl = !!(mods & Qt::ControlModifier); key.keycode = idx; -#endif } +#endif void Shortcuts::reload() { #ifndef _WIN32 -- cgit v1.2.3