statswidget.h 848 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef STATSWIDGET_H
  2. #define STATSWIDGET_H
  3. #include <QWidget>
  4. #include <QLabel>
  5. #include <QVBoxLayout>
  6. #include <QHBoxLayout>
  7. #include <QGroupBox>
  8. #include <QJsonObject>
  9. #include <QJsonArray>
  10. #include <QDateTime>
  11. class StatsWidget : public QWidget
  12. {
  13. Q_OBJECT
  14. public:
  15. explicit StatsWidget(QWidget *parent = nullptr);
  16. ~StatsWidget();
  17. // 更新统计信息
  18. void updateStats(const QJsonObject& statsData);
  19. private:
  20. void setupUI();
  21. void applyStyles();
  22. // UI组件
  23. QGroupBox *m_statsGroup;
  24. QLabel *m_totalCountLabel;
  25. QLabel *m_type0CountLabel;
  26. QLabel *m_type1CountLabel;
  27. QLabel *m_type2CountLabel;
  28. QLabel *m_lastUpdateLabel;
  29. // 数据
  30. int m_totalCount;
  31. int m_type0Count;
  32. int m_type1Count;
  33. int m_type2Count;
  34. QDateTime m_lastUpdate;
  35. };
  36. #endif // STATSWIDGET_H