diff --git a/Bin/Config/Lang/cn/nmNum_cn.qm b/Bin/Config/Lang/cn/nmNum_cn.qm index c8e1a96..fb48122 100644 Binary files a/Bin/Config/Lang/cn/nmNum_cn.qm and b/Bin/Config/Lang/cn/nmNum_cn.qm differ diff --git a/Bin/Config/Lang/cn/nmNum_cn.ts b/Bin/Config/Lang/cn/nmNum_cn.ts index d03690b..da78834 100644 --- a/Bin/Config/Lang/cn/nmNum_cn.ts +++ b/Bin/Config/Lang/cn/nmNum_cn.ts @@ -6542,8 +6542,6 @@ Average pressure in contour: %2 MPa nmWellParameterPanel The well working copy is unavailable.井工作副本不可用。 - Well name井名 - Well type井型 Perforation射孔段 Perforation %1射孔段 %1 No perforations无射孔段 @@ -6559,6 +6557,11 @@ Average pressure in contour: %2 MPa nmWxWellEditor Edit well编辑井 The well working copy is unavailable.井工作副本不可用。 + Well information井信息 + Well number井号 + Well name井名 + Well type井型 + Project-level unique well identifier项目级唯一井标识 Vertical well直井 Fractured vertical well压裂直井 Multistage fractured horizontal well多段压裂水平井 diff --git a/Include/nmNum/nmSubWxs/nmWellParameterCatalog.h b/Include/nmNum/nmSubWxs/nmWellParameterCatalog.h index 4ed1b8b..52b5784 100644 --- a/Include/nmNum/nmSubWxs/nmWellParameterCatalog.h +++ b/Include/nmNum/nmSubWxs/nmWellParameterCatalog.h @@ -41,7 +41,6 @@ struct NM_SUB_WXS_EXPORT nmWellParameterGroupInfo QString m_sTitle; ///< 当前语言下的分组标题。 QList m_listFields; ///< 分组字段。 - bool m_bBasicGroup; ///< 是否承载井名和井型控件。 bool m_bPerforationGroup; ///< 是否创建射孔选择器。 }; diff --git a/Include/nmNum/nmSubWxs/nmWellParameterPanel.h b/Include/nmNum/nmSubWxs/nmWellParameterPanel.h index 9d462eb..948b4c0 100644 --- a/Include/nmNum/nmSubWxs/nmWellParameterPanel.h +++ b/Include/nmNum/nmSubWxs/nmWellParameterPanel.h @@ -14,7 +14,6 @@ class nmIParameterUnitService; class nmParameterField; struct nmWellParameterGroupInfo; class QComboBox; -class QLineEdit; class QVBoxLayout; /** @@ -43,12 +42,6 @@ public: /** @brief 返回全部可见输入是否有效。 */ bool isInputValid(); - /** @brief 返回基础参数分组中的井名输入框,不转移所有权。 */ - QLineEdit* wellNameEditor() const; - - /** @brief 返回基础参数分组中的井型选择器,不转移所有权。 */ - QComboBox* wellTypeEditor() const; - /** @brief 将焦点移动到第一个无效字段。 */ void focusFirstInvalid(); @@ -93,9 +86,6 @@ private: /** @brief 仅同步当前射孔名称,不改变选择器结构和当前选中项。 */ void updateCurrentPerforationItem(); - /** @brief 将井信息控件移回面板,避免分组重建时被一并销毁。 */ - void detachWellInformationEditors(); - /** @brief 收集基准单位值并执行字段及关联规则校验。 */ bool collectValues(QMap& mapValues, QString& sError, @@ -121,8 +111,6 @@ private: nmIParameterUnitService* m_pUnitService; ///< 单位服务,不拥有所有权。 nmDataWellBase* m_pWell; ///< 当前工作副本,不拥有所有权。 QVBoxLayout* m_pMainLayout; ///< 单列分组布局。 - QLineEdit* m_pWellNameLineEdit; ///< 基础分组中的井名输入框。 - QComboBox* m_pWellTypeComboBox; ///< 基础分组中的井型选择器。 QComboBox* m_pPerforationComboBox; ///< 当前射孔选择器。 QList m_listFields; ///< 当前井型字段。 QMap m_mapFields; ///< 稳定ID字段映射。 diff --git a/Include/nmNum/nmSubWxs/nmWxWellEditor.h b/Include/nmNum/nmSubWxs/nmWxWellEditor.h index 3dc7084..55af736 100644 --- a/Include/nmNum/nmSubWxs/nmWxWellEditor.h +++ b/Include/nmNum/nmSubWxs/nmWxWellEditor.h @@ -98,6 +98,9 @@ private: /** @brief 创建左侧参数区、右侧轨迹区和底部命令区。 */ void createUi(); + /** @brief 创建固定显示的井号、井名和井型信息区。 */ + QWidget* createWellInformationWidget(QWidget* pParent); + /** @brief 创建时间变表皮入口、校验提示和确认按钮区。 */ QWidget* createFooter(); @@ -124,6 +127,7 @@ private: nmWellParameterPanel* m_pParameterPanel; ///< 左侧单列参数分组。 nmWxWellboreTrajectoryDisplay* m_pTrajectoryDisplay; ///< 右侧轨迹视图。 nmWellEditorController* m_pWellEditorController; ///< 轨迹交互控制器。 + QLineEdit* m_pWellCodeLineEdit; ///< 只读项目级井号。 QLineEdit* m_pWellNameLineEdit; ///< 井名输入框。 QComboBox* m_pWellTypeComboBox; ///< 井型选择器。 QCheckBox* m_pTimeDependentCheckBox; ///< 时间变表皮开关。 diff --git a/Src/nmNum/nmSubWxs/nmWellParameterCatalog.cpp b/Src/nmNum/nmSubWxs/nmWellParameterCatalog.cpp index 2217303..897fd08 100644 --- a/Src/nmNum/nmSubWxs/nmWellParameterCatalog.cpp +++ b/Src/nmNum/nmSubWxs/nmWellParameterCatalog.cpp @@ -63,8 +63,7 @@ nmWellParameterGroupInfo parameterGroup(const char* pTitle) } nmWellParameterGroupInfo::nmWellParameterGroupInfo() - : m_bBasicGroup(false), - m_bPerforationGroup(false) + : m_bPerforationGroup(false) { } @@ -76,7 +75,6 @@ QList nmWellParameterCatalog::createGroups( // 第一步:所有支持井型都显示通用井筒参数。 nmWellParameterGroupInfo oBasic = parameterGroup("Basic parameters"); - oBasic.m_bBasicGroup = true; oBasic.m_listFields << numericField(NM_WELL_PARAMETER_X, "W_X") << numericField(NM_WELL_PARAMETER_Y, "W_Y") diff --git a/Src/nmNum/nmSubWxs/nmWellParameterPanel.cpp b/Src/nmNum/nmSubWxs/nmWellParameterPanel.cpp index 463df1f..4333daa 100644 --- a/Src/nmNum/nmSubWxs/nmWellParameterPanel.cpp +++ b/Src/nmNum/nmSubWxs/nmWellParameterPanel.cpp @@ -38,8 +38,6 @@ nmWellParameterPanel::nmWellParameterPanel( m_pUnitService(pUnitService), m_pWell(nullptr), m_pMainLayout(new QVBoxLayout(this)), - m_pWellNameLineEdit(new QLineEdit(this)), - m_pWellTypeComboBox(new QComboBox(this)), m_pPerforationComboBox(nullptr), m_listFields(), m_mapFields(), @@ -53,19 +51,6 @@ nmWellParameterPanel::nmWellParameterPanel( m_pMainLayout->setContentsMargins(8, 8, 8, 8); m_pMainLayout->setSpacing(10); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); - - m_pWellNameLineEdit->setFixedHeight(nmParameterField::editorHeight()); - m_pWellNameLineEdit->setMinimumWidth( - nmParameterField::editorMinimumWidth()); - m_pWellNameLineEdit->setSizePolicy( - QSizePolicy::Expanding, QSizePolicy::Fixed); - m_pWellTypeComboBox->setFixedHeight(nmParameterField::editorHeight()); - m_pWellTypeComboBox->setMinimumWidth( - nmParameterField::editorMinimumWidth()); - m_pWellTypeComboBox->setSizePolicy( - QSizePolicy::Expanding, QSizePolicy::Fixed); - m_pWellNameLineEdit->hide(); - m_pWellTypeComboBox->hide(); } nmWellParameterPanel::~nmWellParameterPanel() @@ -216,16 +201,6 @@ bool nmWellParameterPanel::isInputValid() return collectValues(mapValues, sError); } -QLineEdit* nmWellParameterPanel::wellNameEditor() const -{ - return m_pWellNameLineEdit; -} - -QComboBox* nmWellParameterPanel::wellTypeEditor() const -{ - return m_pWellTypeComboBox; -} - void nmWellParameterPanel::focusFirstInvalid() { // 按界面显示顺序定位错误,使用户无需自行查找红色字段。 @@ -368,8 +343,6 @@ void nmWellParameterPanel::slotWellDataChanged() void nmWellParameterPanel::clearGroups() { - // 井信息控件跨井型复用,删除旧基础分组前先转移回参数面板。 - detachWellInformationEditors(); m_listFields.clear(); m_mapFields.clear(); m_pPerforationComboBox = nullptr; @@ -386,22 +359,6 @@ void nmWellParameterPanel::clearGroups() } } -void nmWellParameterPanel::detachWellInformationEditors() -{ - if (m_pWellNameLineEdit != nullptr && - m_pWellNameLineEdit->parentWidget() != this) - { - m_pWellNameLineEdit->setParent(this); - m_pWellNameLineEdit->hide(); - } - if (m_pWellTypeComboBox != nullptr && - m_pWellTypeComboBox->parentWidget() != this) - { - m_pWellTypeComboBox->setParent(this); - m_pWellTypeComboBox->hide(); - } -} - bool nmWellParameterPanel::buildGroup( const nmWellParameterGroupInfo& oGroupInfo, QString& sError) @@ -421,27 +378,8 @@ bool nmWellParameterPanel::buildGroup( pFieldLayout->setColumnMinimumWidth( 2, nmParameterField::unitMinimumWidth()); - // 第二步:基础分组先挂载井信息,输入控件固定在第二列,第三列留给单位。 + // 第二步:射孔选择器只占第二列,不侵入单位列。 int nRowOffset = 0; - if (oGroupInfo.m_bBasicGroup) - { - QLabel* pNameLabel = new QLabel(tr("Well name"), pGroupBox); - QLabel* pTypeLabel = new QLabel(tr("Well type"), pGroupBox); - pNameLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); - pTypeLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); - - m_pWellNameLineEdit->setParent(pGroupBox); - m_pWellTypeComboBox->setParent(pGroupBox); - pFieldLayout->addWidget(pNameLabel, 0, 0); - pFieldLayout->addWidget(m_pWellNameLineEdit, 0, 1); - pFieldLayout->addWidget(pTypeLabel, 1, 0); - pFieldLayout->addWidget(m_pWellTypeComboBox, 1, 1); - m_pWellNameLineEdit->show(); - m_pWellTypeComboBox->show(); - nRowOffset = 2; - } - - // 第三步:射孔选择器同样只占第二列,不侵入单位列。 if (oGroupInfo.m_bPerforationGroup) { QLabel* pSelectorLabel = new QLabel(tr("Perforation"), pGroupBox); @@ -456,7 +394,7 @@ bool nmWellParameterPanel::buildGroup( nRowOffset = 1; } - // 第四步:按目录顺序创建字段,并建立稳定ID到字段对象的索引。 + // 第三步:按目录顺序创建字段,并建立稳定ID到字段对象的索引。 for (int nIndex = 0; nIndex < oGroupInfo.m_listFields.size(); ++nIndex) { nmParameterField* pField = new nmParameterField( @@ -468,10 +406,6 @@ bool nmWellParameterPanel::buildGroup( 0, sError)) { - if (oGroupInfo.m_bBasicGroup) - { - detachWellInformationEditors(); - } delete pGroupBox; return false; } diff --git a/Src/nmNum/nmSubWxs/nmWxWellEditor.cpp b/Src/nmNum/nmSubWxs/nmWxWellEditor.cpp index 80d8bbc..fc6f069 100644 --- a/Src/nmNum/nmSubWxs/nmWxWellEditor.cpp +++ b/Src/nmNum/nmSubWxs/nmWxWellEditor.cpp @@ -18,11 +18,14 @@ #include #include #include +#include +#include #include #include #include #include #include +#include #include #include #include @@ -39,6 +42,7 @@ nmWxWellEditor::nmWxWellEditor(const nmWellEditContext& oContext, m_pParameterPanel(nullptr), m_pTrajectoryDisplay(nullptr), m_pWellEditorController(nullptr), + m_pWellCodeLineEdit(nullptr), m_pWellNameLineEdit(nullptr), m_pWellTypeComboBox(nullptr), m_pTimeDependentCheckBox(nullptr), @@ -88,6 +92,7 @@ bool nmWxWellEditor::initialize(QString& sError) } // 第一步:同步井信息和时间变表皮控件。 + m_pWellCodeLineEdit->setText(pWell->getWellCode()); m_pWellNameLineEdit->setText(pWell->getWellName()); int nWellTypeIndex = m_pWellTypeComboBox->findData( static_cast(pWell->getWellType())); @@ -380,21 +385,21 @@ void nmWxWellEditor::createUi() pMainLayout->setContentsMargins(12, 10, 12, 0); pMainLayout->setSpacing(8); - // 第一步:左侧全部信息进入同一滚动参数面板,右侧保持常驻轨迹视图。 + // 第一步:左侧固定井信息并滚动参数分组,右侧保持常驻轨迹视图。 m_pMainSplitter = new QSplitter(Qt::Horizontal, this); m_pMainSplitter->setChildrenCollapsible(false); QWidget* pParameterContainer = new QWidget(m_pMainSplitter); QVBoxLayout* pParameterLayout = new QVBoxLayout(pParameterContainer); pParameterLayout->setContentsMargins(0, 0, 0, 0); - pParameterLayout->setSpacing(0); + pParameterLayout->setSpacing(8); QScrollArea* pScrollArea = new QScrollArea(pParameterContainer); pScrollArea->setWidgetResizable(true); pScrollArea->setFrameShape(QFrame::NoFrame); m_pParameterPanel = new nmWellParameterPanel(this, pScrollArea); - m_pWellNameLineEdit = m_pParameterPanel->wellNameEditor(); - m_pWellTypeComboBox = m_pParameterPanel->wellTypeEditor(); + pParameterLayout->addWidget( + createWellInformationWidget(pParameterContainer)); m_pWellTypeComboBox->addItem( tr("Vertical well"), static_cast(Vertical_Well)); m_pWellTypeComboBox->addItem( @@ -431,6 +436,54 @@ void nmWxWellEditor::createUi() this, SLOT(slotPanelValidationMessageChanged(QString))); } +QWidget* nmWxWellEditor::createWellInformationWidget(QWidget* pParent) +{ + QGroupBox* pInformationGroup = new QGroupBox( + tr("Well information"), pParent); + QGridLayout* pInformationLayout = new QGridLayout(pInformationGroup); + pInformationLayout->setContentsMargins(8, 15, 8, 10); + pInformationLayout->setHorizontalSpacing(6); + pInformationLayout->setVerticalSpacing(6); + pInformationLayout->setColumnStretch(0, 0); + pInformationLayout->setColumnStretch(1, 1); + + QLabel* pCodeLabel = new QLabel(tr("Well number"), pInformationGroup); + QLabel* pNameLabel = new QLabel(tr("Well name"), pInformationGroup); + QLabel* pTypeLabel = new QLabel(tr("Well type"), pInformationGroup); + pCodeLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); + pNameLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); + pTypeLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); + + m_pWellCodeLineEdit = new QLineEdit(pInformationGroup); + m_pWellNameLineEdit = new QLineEdit(pInformationGroup); + m_pWellTypeComboBox = new QComboBox(pInformationGroup); + m_pWellCodeLineEdit->setReadOnly(true); + m_pWellCodeLineEdit->setToolTip( + tr("Project-level unique well identifier")); + + QList listEditors; + listEditors << m_pWellCodeLineEdit + << m_pWellNameLineEdit + << m_pWellTypeComboBox; + for (int nIndex = 0; nIndex < listEditors.size(); ++nIndex) + { + listEditors[nIndex]->setFixedHeight( + nmParameterField::editorHeight()); + listEditors[nIndex]->setMinimumWidth( + nmParameterField::editorMinimumWidth()); + listEditors[nIndex]->setSizePolicy( + QSizePolicy::Expanding, QSizePolicy::Fixed); + } + + pInformationLayout->addWidget(pCodeLabel, 0, 0); + pInformationLayout->addWidget(m_pWellCodeLineEdit, 0, 1); + pInformationLayout->addWidget(pNameLabel, 1, 0); + pInformationLayout->addWidget(m_pWellNameLineEdit, 1, 1); + pInformationLayout->addWidget(pTypeLabel, 2, 0); + pInformationLayout->addWidget(m_pWellTypeComboBox, 2, 1); + return pInformationGroup; +} + QWidget* nmWxWellEditor::createFooter() { QWidget* pFooter = new QWidget(this);