1 #ifndef KEYTEST_H 2 #define KEYTEST_H 3 4 #include <QWidget> 5 6 #define KEYMAXNUM 4 7 8 class QSocketNotifier; //need this class 9 10 namespace Ui 11 { 12 class Keytest; 13 } 14 15 #define KEY_V_UP 115 16 #define KEY_V_DOWN 114 17 #define KEY_V_HOME 139 18 #define KEY_V_ESC 158 19 20 class Keytest : public QWidget 21 { 22 Q_OBJECT 23 24 public: 25 explicit Keytest(QWidget *parent = 0); 26 ~Keytest(); 27 QWidget *parent; 28 29 protected: 30 void paintEvent(QPaintEvent* e); 31 32 33 private: 34 Ui::Keytest *ui; 35 volatile int m_fd; 36 QSocketNotifier* m_notifyObject; 37 bool m_oldButtonsState[KEYMAXNUM]; 38 39 private slots: 40 void keyEvent(); 41 42 }; 43 44 #endif // KEYTEST_H 45