添加OpenCv
This commit is contained in:
49
PublicFunctions/CurvePlotWidget.h
Normal file
49
PublicFunctions/CurvePlotWidget.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef CURVEPLOTWIDGET_H
|
||||
#define CURVEPLOTWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtCharts/QChart>
|
||||
#include <QtCharts/QChartView>
|
||||
#include <QtCharts/QLineSeries>
|
||||
#include <QtCharts/QValueAxis>
|
||||
#include <QtCharts/QDateTimeAxis>
|
||||
#include <QGraphicsLayout>
|
||||
#include <QDateTime>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace QtCharts {
|
||||
class QChart;
|
||||
class QChartView;
|
||||
class QLineSeries;
|
||||
class QValueAxis;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class CurvePlotWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CurvePlotWidget(QWidget *parent = nullptr);
|
||||
|
||||
int addSeries(const QString &name, const QColor &color);
|
||||
void appendPoint(int seriesIndex, double yValue);
|
||||
protected:
|
||||
void changeEvent(QEvent *e) override;
|
||||
|
||||
|
||||
private:
|
||||
void initChart();
|
||||
void updateAxisRange();
|
||||
|
||||
QtCharts::QChart *m_chart = nullptr;
|
||||
QtCharts::QChartView *m_view = nullptr;
|
||||
QList<QtCharts::QLineSeries*> m_series;
|
||||
QtCharts::QDateTimeAxis *m_axisX = nullptr; // 替换
|
||||
QtCharts::QValueAxis *m_axisY = nullptr;
|
||||
|
||||
static constexpr int MAX_POINTS = 300;
|
||||
static constexpr int TIME_WINDOW_S = 300; // 600 秒 = 10 分钟
|
||||
int m_tick = 0;
|
||||
};
|
||||
|
||||
#endif // CURVEPLOTWIDGET_H
|
||||
Reference in New Issue
Block a user