From d6a80a106a43ec48b0f4631a5ff7f2a141e954ae Mon Sep 17 00:00:00 2001 From: Evgeny Proydakov Date: Sun, 31 Jul 2011 03:44:44 +0400 Subject: [PATCH] Updated GUI - added keyPress control --- v_joy_qt_gui.cpp | 23 +++++++++++++++++++++++ v_joy_qt_gui.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/v_joy_qt_gui.cpp b/v_joy_qt_gui.cpp index a23f531..7a26e39 100644 --- a/v_joy_qt_gui.cpp +++ b/v_joy_qt_gui.cpp @@ -162,6 +162,29 @@ void VJoyQtGUI::slotBallChanged(int id, int stateX, int stateY) } +void VJoyQtGUI::keyPressEvent(QKeyEvent *event) +{ + event->accept(); + switch(event->key()) { + case Qt::Key_S: + scanDevices(); + break; + case Qt::Key_C: + connectToDevices(); + break; + case Qt::Key_D: + disconnectFromDevices(); + break; + case Qt::Key_Escape: + close(); + break; + default: + event->ignore(); + break; + } + QMainWindow::keyPressEvent(event); +} + void VJoyQtGUI::setJoystickInfoVisible(bool visible) { if(visible) { diff --git a/v_joy_qt_gui.h b/v_joy_qt_gui.h index 508788c..0f8466a 100644 --- a/v_joy_qt_gui.h +++ b/v_joy_qt_gui.h @@ -26,6 +26,7 @@ #define __V_VIDEO_SERVER_ #include +#include #include namespace Ui @@ -55,6 +56,8 @@ private slots: void slotBallChanged(int id, int stateX, int stateY); private: + void keyPressEvent(QKeyEvent *event); + void setJoystickInfoVisible(bool visible); void setDeviceControlVisible(bool visible);