#ifndef NMWXEDITWELLPLOT_H #define NMWXEDITWELLPLOT_H #include "iDlgBase.h" #include "nmSubWxs_global.h" #include // 前向声明需要的Qt布局和控件类 class QHBoxLayout; class QVBoxLayout; class QSplitter; class QGridLayout; class QLineEdit; class QComboBox; class QKeyEvent; class QCheckBox; class QPushButton; class QString; // 自定义容器 class iWxWellNew; class nmWxWellboreTrajectoryDisplay; // 数据源 class ZxDataWell; class nmDataAttribute; class nmDataWellBase; class nmDataVerticalWell; class nmDataVerticalFracturedWell; class nmDataHorizontalFracturedWell; class nmDataPerforation; // 自定义GUI组件类 class nmGUIComponentBase; class nmGUIComponentLineEdit; class nmGUIComponentComboBox; // 编辑井控制器 class nmWellEditorController; class NM_SUB_WXS_EXPORT nmWxEditWellPlot : public iDlgBase { Q_OBJECT public: explicit nmWxEditWellPlot(QWidget *parent = nullptr, ZxDataWell* pZxDataWell = nullptr, nmDataWellBase* pNmDataWell = nullptr); ~nmWxEditWellPlot(); // 初始化界面 void initUI(); // 初始化界面主布局 void initMainLayout(); // 创建左侧面板容器,包含m_pWellNewWidget和m_pBottomLeftPanel QWidget* createLeftPanel(); // 创建右侧面板容器,即井筒轨迹显示 QWidget* createRightPanel(); // 创建最底部面板容器 QWidget* createBottomPanel(); // 连接视图与控制器之间的信号槽 void setupControllerConnections(); // 新增一个辅助函数来动态更新底部左侧面板的UI void updateBottomLeftPanelUI(); // 辅助函数,用于向网格布局中添加 nmGUIComponentBase 组件 // 注意:传入 nmDataAttribute 的引用,并且 const_cast 转换是安全的,因为组件需要修改其值 void addLineEditComponentToGrid(nmDataAttribute& attribute, int& row); void addComboBoxComponentToGrid(nmDataAttribute& attribute, int& row); // 根据井类型添加特定参数的私有辅助函数 void addVerticalWellParameters(nmDataVerticalWell* well, int& row); void addVerticalFracturedWellParameters(nmDataVerticalFracturedWell* well, int& row); void addHorizontalFracturedWellParameters(nmDataHorizontalFracturedWell* well, int& row); // 返回修改后的井数据 nmDataWellBase* getModifiedDataWell(); //public slots: // void onTimeDependentIconClicked(); // // 新添加的槽函数 // void onTimeDependentCheckToggled(bool checked); protected: void keyPressEvent(QKeyEvent *event) override; private slots: // 确认和取消按钮的槽函数 void onOkClicked(); void onCancelClicked(); // 连接模型数据变化的槽函数,用于刷新左侧参数列表 void onWellDataChanged(); // 切换井类型的槽函数 void onWellTypeChanged(int index); // 井名称修改 void onWellNameEditingFinished(); void onTimeDependentIconClicked(); void onTimeDependentCheckToggled(bool checked); private: QSplitter* m_pMainSplitter; // 主分割器 QVBoxLayout* m_pTopVLayout; // 顶层垂直布局 QVBoxLayout* m_pLeftVLayout; // 左侧垂直布局 QGridLayout* m_pBottomLeftGridLayout; // 参数面板的网格布局 QLineEdit* m_pWellNameLineEdit; // 井名编辑框 QComboBox* m_pWellTypeComboBox; // 井类型选择下拉框 iWxWellNew* m_pWellNewWidget; // 嵌入的 iWxWellNew 实例 QWidget* m_pBottomLeftPanel; // 底部左侧自定义参数面板 nmWxWellboreTrajectoryDisplay* m_pRightPanel; // 右侧井筒轨迹视图面板 QWidget* m_pOverallBottomPanel; // 整个界面最底部的容器 ZxDataWell* m_pZxDataWell; // 存储传入的井数据 nmDataWellBase* m_pNmDataWell; // 数值井数据 QList m_listParameterComponents; // 参数面板下自定义的参数组件 nmWellEditorController* m_pWellEditorController; // 编辑井控制器 // 时间相关控件 QCheckBox* m_pTimeDependentCheck; QPushButton* m_pTimeDependentIconButton; QString m_sIconDir; // 图标目录路径,如果还没有定义的话 bool m_bOriginalTimeDependentSkin; }; #endif // NMWXEDITWELLPLOT_H