diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-25 06:45:03 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-07-25 06:57:23 +0200 |
commit | e646166be460dce1553360463992d3df018d1906 (patch) | |
tree | b2bd78850f0f3db7577a872ce452f273ce3e4531 /facetracknoir | |
parent | 7224592458521a0c2312fcc29e33764c271cd4dc (diff) |
shortcuts: also guard against multiple-modifier combos
Diffstat (limited to 'facetracknoir')
-rw-r--r-- | facetracknoir/keyboard.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/facetracknoir/keyboard.h b/facetracknoir/keyboard.h index ccfd7a84..a7673f8f 100644 --- a/facetracknoir/keyboard.h +++ b/facetracknoir/keyboard.h @@ -2,6 +2,7 @@ #include "ui_keyboard_listener.h" #include <QLabel> #include <QKeyEvent> +#include <QDebug> class KeyboardListener : public QLabel { @@ -15,18 +16,21 @@ public: } void keyPressEvent(QKeyEvent* event) override { + //qDebug() << "k" << (event->key() | event->modifiers()); + switch (event->key() | event->modifiers()) { - switch (event->key() | event->modifiers()) - { - case 83886113: // ctrl - case 50331680: // shift - case 150994979: // alt - case 16777250: // meta - return; - default: break; - } + case 83886113: // ctrl + case 50331680: // shift + case 150994979: // alt + case 218103841: // ctrl+alt + case 117440545: // ctrl+shift + case 184549408: // alt+shift + case 251658272: // ctrl+alt+shift + break; + default: + emit key_pressed(QKeySequence(event->key() | event->modifiers())); + break; } - emit key_pressed(QKeySequence(event->key() | event->modifiers())); } signals: void key_pressed(QKeySequence k); |