You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

51 line
817 B

  1. #ifndef ONOFFSTATUSWIDGET_H
  2. #define ONOFFSTATUSWIDGET_H
  3. #include <QWidget>
  4. #include <QRect>
  5. #include <QTimer>
  6. #include <QLabel>
  7. class CONOFFStatusWidget : public QWidget
  8. {
  9. Q_OBJECT
  10. public:
  11. enum eONOFFLedColor
  12. {
  13. ON_OFF_LED_COLOR_GREEN,
  14. ON_OFF_LED_COLOR_RED
  15. };
  16. CONOFFStatusWidget(eONOFFLedColor Color,int index = -1, QWidget *Parent = NULL,QString Label = QString());
  17. ~CONOFFStatusWidget();
  18. void paintEvent(QPaintEvent *PaintEvent);
  19. void resizeEvent(QResizeEvent *);
  20. void mouseReleaseEvent(QMouseEvent *event);
  21. QLabel *mLabel;
  22. QPixmap mLedOnPixmap,mLedOffPixmap;
  23. bool mIsOn;
  24. void SetON();
  25. void SetOFF();
  26. void Toggle();
  27. void SetState(bool IsON);
  28. int mIndex;
  29. signals:
  30. void Clicked(int index);
  31. };
  32. #endif // ONOFFSTATUSWIDGET_H