1 #ifndef KEYTEST_H 2 #define KEYTEST_H 3 4 #include <QWidget> 5 6 #define KEYMAXNUM 5 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_MENU 139 18 #define KEY_V_ENTER 28 19 #define KEY_V_HOME 102 20 21 class Keytest : public QWidget 22 { 23 Q_OBJECT 24 25 public: 26 explicit Keytest(QWidget *parent = 0); 27 ~Keytest(); 28 QWidget *parent; 29 30 protected: 31 void paintEvent(QPaintEvent* e); 32 33 34 private: 35 Ui::Keytest *ui; 36 volatile int m_fd; 37 QSocketNotifier* m_notifyObject; 38 bool m_oldButtonsState[KEYMAXNUM]; 39 40 private slots: 41 void keyEvent(); 42 43 }; 44 45 #endif // KEYTEST_H 46