#pragma once #include "Defines.h" #include "IxSerDes.h" #include "ZxXpf.h" #include "ZxSerializer.h" #include "iPlotWxT_global.h" class tCurvePlotScene; class tCurvePlotView; class ZxPlot; class ZxObjCurve; class tCurveObjFlow; class ZxSubAxisBase; class ZxObjCurveBase; // 这是最基础的绘图窗体 class I_PLOTWX_T_EXPORT iPlotBaseWxT : public QWidget, virtual public IxSerDes { Q_OBJECT public: explicit iPlotBaseWxT(QWidget *parent = 0); ~iPlotBaseWxT(); // 初始化UI virtual void initUI(QString sTitle, QSize szDefault = QSize(265, 203)); virtual void clearAllPlots(); public: // 坐标轴相关设置 virtual void setAxisX(QString sName, QString sUnit = ""); virtual void setAxisY(QString sName, QString sUnit = "", bool bY2 = false); virtual void setAxisXY(int nIndexXY, QString sName, QString sUnit = ""); virtual void setAxisScaleX(double fMin, double fMax, VecDouble& vecTicks); virtual void setAxisScaleY(double fMin, double fMax, VecDouble& vecTicks); virtual void setAxisScaleY2(double fMin, double fMax, VecDouble& vecTicks); virtual void setAxisScaleXY(int nIndexXY, double& fMin, double& fMax, VecDouble& vecTicks); virtual void setAxisXYLog(bool bLogAxis, int nIndexXY); // nIndexXY:0 x轴,1 左侧y轴,2 右侧y轴 ZxSubAxisBase* getAxisOf(int nIndexXY); void copyAxisScalesTo(iPlotBaseWxT* pDest, int nIndexXY = -1); // 设置x轴的基准时间 void setAxisBaseDtX(QDateTime dt); QDateTime getAxisBaseDtX() const; virtual void connectSignals(); // 序列化 virtual void onSerialize(ZxSerializer* ser); virtual void onDeserialize(ZxSerializer* ser); virtual void resetAfterDeserialized(); protected: virtual void initChartView(QString sTitle, QSize szDefault); virtual void resizeEvent(QResizeEvent *); virtual void paintEvent(QPaintEvent *); // 窗体关闭的情形 virtual void closeEvent(QCloseEvent *); // 处理Resize,主要是正方形网格 bool changeToSize(QSize sz, bool bResizeMode); public slots: virtual void slotChangeSizeWithChangedXY(); // 缩放复原 virtual void zoomReset(); signals: void sigZoomReset(); // 在关闭的消息函数中触发 void sigConfirmClosing(bool& bClosable); public: // 内部变量 tCurvePlotView* m_pPlotView; tCurvePlotScene* m_pPlotScene; ZxPlot* m_pPlot; protected: QLayout* m_pMainLayout; // 记录各坐标轴原始状态 // 为了回归原始 double m_fMaxX; double m_fMinX; double m_fMaxY; double m_fMinY; double m_fMaxY2; double m_fMinY2; VecDouble m_vecTicksX; VecDouble m_vecTicksY; VecDouble m_vecTicksY2; // 信号槽标识开关 bool m_bUnableSP; // 是否启用新的样式表,ZXF202407 bool m_bNovelQss; };