| 1 | #ifndef INTERACTIVEBUTTON |
| 2 | #define INTERACTIVEBUTTON |
| 3 | |
| 4 | #include <QPushButton> |
| 5 | |
| 6 | class InteractiveButton : public QPushButton |
| 7 | { |
| 8 | Q_OBJECT |
| 9 | public: |
| 10 | InteractiveButton(QWidget* parent = nullptr); |
| 11 | |
| 12 | void highlight(bool state); |
| 13 | void mustBeSet(bool state); |
| 14 | |
| 15 | signals: |
| 16 | void mouseOver(bool state); |
| 17 | // this one is specific for the VDPRegViewer and depends on the |
| 18 | // name of the button also |
| 19 | void newBitValue(int reg, int bit, bool state); |
| 20 | |
| 21 | protected: |
| 22 | void enterEvent(QEvent* event) override; |
| 23 | void leaveEvent(QEvent* event) override; |
| 24 | |
| 25 | private: |
| 26 | // this one is specific for the VDPRegViewer |
| 27 | void newBitValueSlot(bool); |
| 28 | |
| 29 | void setColor(); |
| 30 | |
| 31 | private: |
| 32 | bool _mustBeSet; |
| 33 | bool _highlight; |
| 34 | bool _state; |
| 35 | }; |
| 36 | |
| 37 | #endif // INTERACTIVEBUTTON |