diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-11-11 06:14:00 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-11-11 06:14:00 +0100 |
commit | 2d90e4039c6dd1aab00c738f9bbc70a4949cd583 (patch) | |
tree | 9150b0f8732c51f767a705272bede9345c274901 /gui/keyboard.h | |
parent | 2521a7918783758928a58f6032ca6fad53a89c01 (diff) |
allow for binding joystick buttons to shortcut functions
Win32 only
Issue: #118
Diffstat (limited to 'gui/keyboard.h')
-rw-r--r-- | gui/keyboard.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gui/keyboard.h b/gui/keyboard.h index 03edacc7..aa4b4a24 100644 --- a/gui/keyboard.h +++ b/gui/keyboard.h @@ -20,10 +20,17 @@ public: #ifdef _WIN32 , w([&](Key& k) { - Qt::KeyboardModifiers m; - QKeySequence k_; - if (win_key::to_qt(k, k_, m)) - key_pressed(static_cast<QVariant>(k_).toInt() | m); + if(k.guid != "") + { + joystick_button_pressed(k.guid, k.keycode); + } + else + { + Qt::KeyboardModifiers m; + QKeySequence k_; + if (win_key::to_qt(k, k_, m)) + key_pressed(static_cast<QVariant>(k_).toInt() | m); + } }, this->winId()) #endif { @@ -47,4 +54,5 @@ public: #endif signals: void key_pressed(QKeySequence k); + void joystick_button_pressed(QString guid, int idx); }; |