2026-03-26 19:07:49 +08:00
|
|
|
#ifndef ENERGYCOUNTPEAKFITVIEW_H
|
|
|
|
|
#define ENERGYCOUNTPEAKFITVIEW_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
#include <MeasureAnalysisView.h>
|
2026-04-15 18:17:16 +08:00
|
|
|
#include <QwtPlotPicker>
|
|
|
|
|
#include <QwtPickerDragRectMachine>
|
|
|
|
|
#include <QRubberBand> // 新增
|
|
|
|
|
#include <qwt_plot_shapeitem.h> // 新增
|
2026-03-26 19:07:49 +08:00
|
|
|
|
2026-04-15 18:17:16 +08:00
|
|
|
class PlotRectItem; // 前向声明
|
2026-03-26 19:07:49 +08:00
|
|
|
class QMenu;
|
|
|
|
|
class CustomQwtPlot;
|
|
|
|
|
class CustomQwtPlotXaxisSelector;
|
2026-04-15 18:17:16 +08:00
|
|
|
class QwtPlotPicker;
|
|
|
|
|
class QwtPlotCurve;
|
2026-03-26 19:07:49 +08:00
|
|
|
class EnergyCountPeakFitView : public MeasureAnalysisView
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
EnergyCountPeakFitView(QWidget *parent = nullptr);
|
|
|
|
|
virtual ~EnergyCountPeakFitView();
|
|
|
|
|
|
|
|
|
|
virtual void InitViewWorkspace(const QString& project_name) override final;
|
|
|
|
|
virtual void SetAnalyzeDataFilename(const QMap<QString, QVariant>& data_files_set);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void setupPlot();
|
|
|
|
|
void setupMenu();
|
|
|
|
|
void loadDataFromFile(const QString &data_name, const QString& filename);
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void onActionCurveShowSetting();
|
|
|
|
|
void onActionPlotConfigure();
|
2026-04-15 18:17:16 +08:00
|
|
|
void clearAllSelectionRects();
|
|
|
|
|
protected:
|
|
|
|
|
bool eventFilter(QObject* watched, QEvent* event) override; // 事件过滤器
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void startSelection(const QPoint& pos);
|
|
|
|
|
void updateSelection(const QPoint& pos);
|
|
|
|
|
void finishSelection();
|
|
|
|
|
QRectF pixelRectToPlotRect(const QRect& pixelRect) const;
|
|
|
|
|
void addSelectionRect(const QRectF& plotRect);
|
|
|
|
|
|
2026-03-26 19:07:49 +08:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
CustomQwtPlot* _plot = nullptr;
|
|
|
|
|
QMenu* _menu = nullptr;
|
|
|
|
|
QDialog* _curve_show_setting_dlg = nullptr;
|
|
|
|
|
CustomQwtPlotXaxisSelector* _data_selector = nullptr;
|
2026-04-15 18:17:16 +08:00
|
|
|
// 手动框选状态
|
|
|
|
|
bool _isSelecting = false;
|
|
|
|
|
QPoint _selectionStart;
|
|
|
|
|
QRubberBand* _rubberBand = nullptr; // 原生橡皮筋
|
|
|
|
|
QList<PlotRectItem*> _selectionRectItems;
|
|
|
|
|
|
|
|
|
|
QwtPlotCurve* _fittedCurve = nullptr; // 显示拟合结果的曲线
|
|
|
|
|
|
|
|
|
|
|
2026-03-26 19:07:49 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // ENERGYCOUNTPEAKFITVIEW_H
|