From e646166be460dce1553360463992d3df018d1906 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 25 Jul 2015 06:45:03 +0200 Subject: shortcuts: also guard against multiple-modifier combos --- facetracknoir/keyboard.h | 24 ++++++++++++++---------- 1 file 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 #include +#include 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); -- cgit v1.2.3