first commit
This commit is contained in:
95
widgets/waveformwidget.h
Normal file
95
widgets/waveformwidget.h
Normal file
@@ -0,0 +1,95 @@
|
||||
#ifndef WAVEFORMWIDGET_H
|
||||
#define WAVEFORMWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include <QSpinBox>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QTableWidget>
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
#include <QCheckBox>
|
||||
|
||||
/**
|
||||
* @brief 波形采集页面
|
||||
*
|
||||
* 功能说明:
|
||||
* - 信号采集和记录
|
||||
* - 生成曲线功能
|
||||
* - 采集速率≤25ms/点
|
||||
* - 采集通道数≥2
|
||||
* - 采集电压/电流信号
|
||||
* - 自动计算最大/最小/平均值
|
||||
*/
|
||||
class WaveformWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WaveformWidget(QWidget *parent = nullptr);
|
||||
~WaveformWidget() = default;
|
||||
|
||||
signals:
|
||||
void backRequested();
|
||||
|
||||
private slots:
|
||||
void onStartCapture();
|
||||
void onStopCapture();
|
||||
void onClearData();
|
||||
void onExportData();
|
||||
void onTimerTick();
|
||||
|
||||
private:
|
||||
void setupUI();
|
||||
QWidget *createTitleBar();
|
||||
QWidget *createConfigPanel();
|
||||
QWidget *createWaveformDisplay();
|
||||
QWidget *createDataPanel();
|
||||
QWidget *createStatisticsPanel();
|
||||
void updateStatistics();
|
||||
void addDataPoint(double ch1Value, double ch2Value);
|
||||
|
||||
// 标题栏
|
||||
QPushButton *m_backBtn;
|
||||
QLabel *m_titleLabel;
|
||||
|
||||
// 配置面板
|
||||
QComboBox *m_signalTypeCombo;
|
||||
QComboBox *m_sampleRateCombo;
|
||||
QSpinBox *m_durationSpin;
|
||||
QCheckBox *m_ch1Enable;
|
||||
QCheckBox *m_ch2Enable;
|
||||
|
||||
// 控制按钮
|
||||
QPushButton *m_startBtn;
|
||||
QPushButton *m_stopBtn;
|
||||
QPushButton *m_clearBtn;
|
||||
QPushButton *m_exportBtn;
|
||||
|
||||
// 波形显示
|
||||
QWidget *m_waveformArea;
|
||||
QLabel *m_ch1Label;
|
||||
QLabel *m_ch2Label;
|
||||
|
||||
// 数据表格
|
||||
QTableWidget *m_dataTable;
|
||||
|
||||
// 统计信息
|
||||
QLabel *m_ch1MaxLabel;
|
||||
QLabel *m_ch1MinLabel;
|
||||
QLabel *m_ch1AvgLabel;
|
||||
QLabel *m_ch2MaxLabel;
|
||||
QLabel *m_ch2MinLabel;
|
||||
QLabel *m_ch2AvgLabel;
|
||||
|
||||
// 采集状态
|
||||
QTimer *m_captureTimer;
|
||||
bool m_isCapturing;
|
||||
QVector<double> m_ch1Data;
|
||||
QVector<double> m_ch2Data;
|
||||
int m_dataIndex;
|
||||
};
|
||||
|
||||
#endif // WAVEFORMWIDGET_H
|
||||
Reference in New Issue
Block a user