#ifndef ENERGYCOUNTPEAKFITVIEW_H #define ENERGYCOUNTPEAKFITVIEW_H #include #include #include #include #include #include // 新增 #include // 新增 class PlotRectItem; // 前向声明 class QMenu; class CustomQwtPlot; class CustomQwtPlotXaxisSelector; class QwtPlotPicker; class QwtPlotCurve; 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& data_files_set); private: void setupPlot(); void setupMenu(); void loadDataFromFile(const QString &data_name, const QString& filename); private slots: void onActionCurveShowSetting(); void onActionPlotConfigure(); 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); private: CustomQwtPlot* _plot = nullptr; QMenu* _menu = nullptr; QDialog* _curve_show_setting_dlg = nullptr; CustomQwtPlotXaxisSelector* _data_selector = nullptr; // 手动框选状态 bool _isSelecting = false; QPoint _selectionStart; QRubberBand* _rubberBand = nullptr; // 原生橡皮筋 QList _selectionRectItems; QwtPlotCurve* _fittedCurve = nullptr; // 显示拟合结果的曲线 }; #endif // ENERGYCOUNTPEAKFITVIEW_H