| 1 | // |
| 2 | // keygrabber.h - Widget to grab a key and dismiss itself |
| 3 | // |
| 4 | // by James Hammons |
| 5 | // (C) 2011 Underground Software |
| 6 | // |
| 7 | |
| 8 | #ifndef __KEYGRABBER_H__ |
| 9 | #define __KEYGRABBER_H__ |
| 10 | |
| 11 | #include <QtWidgets> |
| 12 | |
| 13 | class KeyGrabber: public QDialog |
| 14 | { |
| 15 | Q_OBJECT |
| 16 | |
| 17 | public: |
| 18 | KeyGrabber(QWidget * parent = 0); |
| 19 | ~KeyGrabber(); |
| 20 | void SetKeyText(int); |
| 21 | |
| 22 | protected: |
| 23 | void keyPressEvent(QKeyEvent *); |
| 24 | |
| 25 | private slots: |
| 26 | void CheckGamepad(); |
| 27 | |
| 28 | private: |
| 29 | QLabel * label; |
| 30 | QTimer * timer; |
| 31 | static bool buttonDown; // Class variable |
| 32 | static int button; // Class variable |
| 33 | |
| 34 | public: |
| 35 | int key; |
| 36 | }; |
| 37 | |
| 38 | #endif // __KEYGRABBER_H__ |