123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #ifndef CHART_FILE_H
- #define CHART_FILE_H
- #include <QWidget>
- #include <QChart>
- #include <QLineSeries>
- #include <QVector>
- #include <QTimer>
- #include <QStandardItemModel>
- #include <QCheckBox>
- #include <QValueAxis>
- #include <QChartView>
- #include "code/tree/tree_model_set.h"
- //QT_USE_NAMESPACE
- namespace Ui {
- class chart_file;
- }
- class chart_file : public QWidget
- {
- Q_OBJECT
- public:
- explicit chart_file(QWidget *parent = nullptr);
- ~chart_file();
- void setTreeModel(tree_model_set *model); // 接受 tree_model_set 实例
- void setPointsNum(int num);
- void addChartData(float time, float *pointsDis);
- signals:
- void treeItemClicked(const QModelIndex &index);
- private:
- Ui::chart_file *ui;
- void wheelEvent(QWheelEvent *event);
- tree_model_set *treeModel; // 保存 tree_model_set 实例的指针
- void initUI();
- void initChart();
- void initSlot();
- void initTable(int pointsNumber);
- void initFontColor();
- void handleTreeItemClicked(const QModelIndex &index);
- void initReadData();
- void addData();
- QChartView *chartView;
- QChart *chart;
- QLineSeries *series[8];
- int pointsSize;//用于画曲线的数据点数
- float *time;
- float *point1;
- float *point2;
- int pointsNum;
- float **tempDis;//store dis,mini dis, max dis for every points;
- QTimer *timer;
- quint16 count;
- private slots:
- void timerSlot();
- void selectAll();
- void invertSelect();
- void checkboxChanged();
- private:
- QVector<QCheckBox *> checkBoxVector;
- QString strColor[9];
- QVector<QColor> colorTable;
- QStandardItemModel *model;
- QValueAxis *axisX;
- QValueAxis *axisY;
- void addTableData(float **pointsDis);
- void on_btn_clear_clicked();
- void on_btn_save_clicked();
- };
- #endif // CHART_FILE_H
|