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.

52 lines
1.2 KiB

  1. #ifndef WIDGETPLOT2D_H
  2. #define WIDGETPLOT2D_H
  3. #include <QCheckBox>
  4. #include <QLabel>
  5. #include <QPushButton>
  6. #include <QWidget>
  7. #include "qcustomplot.h"
  8. namespace Ui {
  9. class WidgetPlot2D;
  10. }
  11. class WidgetPlot2D : public QWidget {
  12. Q_OBJECT
  13. public:
  14. explicit WidgetPlot2D(QWidget *parent = 0);
  15. ~WidgetPlot2D();
  16. void initGraphName(QStringList name);
  17. private:
  18. Ui::WidgetPlot2D *ui;
  19. QVector<QCheckBox *> isShowCheckBoxVector; // 是否显示勾选框
  20. QVector<QLabel *> valueLabelVector; // label数值显示
  21. QVector<QPushButton *> GraphColorPushButtonVector; // 曲线颜色选择按钮
  22. QMap<QString, int> nameToGraphMap; // 曲线名称对应曲线序号
  23. QVector<double> valueVector; // 存储曲线的当前值
  24. int pointCnt[100] = {0};
  25. void initQCP();
  26. void initWidget();
  27. void setTheme(QColor axis, QColor background);
  28. bool isDirExist(QString fullPath);
  29. void savePlotPng();
  30. private slots:
  31. void changeGraphVisible();
  32. void changeGraphColor();
  33. void plotOperation();
  34. void horzScrollBarChanged(int value);
  35. void changePlotTheme();
  36. public slots:
  37. void addData(QString name, double value, int offms);
  38. };
  39. #endif // WIDGETPLOT2D_H