1 #ifndef KEYBUTTON_H 2 #define KEYBUTTON_H 3 #include <QPushButton> 4 5 class KeyButton : public QPushButton 6 { 7 Q_OBJECT 8 public: 9 KeyButton(QWidget *parent=Q_NULLPTR); 10 void setValue(const QString &value); 11 QString getValue(); 12 void setText(const QString &text); 13 void shift(); 14 void caps(); 15 void setKey(Qt::Key key); 16 Qt::Key getKey(); 17 private: 18 void paintEvent(QPaintEvent *e) override; 19 void mousePressEvent(QMouseEvent*e); 20 void mouseReleaseEvent(QMouseEvent*e); 21 QString m_value; 22 QString m_text; 23 bool m_bCaps; 24 Qt::Key m_key; 25 bool m_pressed; 26 }; 27 28 #endif // KEYBUTTON_H 29