countdownwidget.h 490 B

1234567891011121314151617181920212223242526272829
  1. #ifndef COUNTDOWNWIDGET_H
  2. #define COUNTDOWNWIDGET_H
  3. #include <QWidget>
  4. #include <QTimer>
  5. #include <QPainter>
  6. class CountdownWidget : public QWidget
  7. {
  8. Q_OBJECT
  9. public:
  10. explicit CountdownWidget(QWidget *parent = nullptr);
  11. ~CountdownWidget();
  12. protected:
  13. void paintEvent(QPaintEvent *event) override;
  14. signals:
  15. void countdownFinished();
  16. private slots:
  17. void onTimerTimeout();
  18. private:
  19. QTimer *m_timer;
  20. int m_remainingSeconds;
  21. };
  22. #endif // COUNTDOWNWIDGET_H