refactor(numerical): 合并模型与结果区域并统一控件样式

- 合并模型选择与结果井选择分组
- 统一主选项和求解器设置的控件尺寸与布局
- 移除字段标签冒号并更新中文翻译
feature/refactor-numerical-model-panel-20260824
lh 2 weeks ago
parent 1770047183
commit 01914259fe

Binary file not shown.

@ -4823,20 +4823,16 @@ Please check your input coordinates.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<source>View well result</source> <source>Model and result</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<source>Current well:</source> <source>Current well</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<source>Current model:</source> <source>Current model</source>
<translation></translation> <translation></translation>
</message>
<message>
<source>Model selection</source>
<translation></translation>
</message> </message>
<message> <message>
<source>Oil single-phase constant pvt</source> <source>Oil single-phase constant pvt</source>
@ -4975,8 +4971,8 @@ Please check your input coordinates.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<source>Solver library:</source> <source>Solver library</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<source>CPU accelerated solver</source> <source>CPU accelerated solver</source>
@ -4987,12 +4983,12 @@ Please check your input coordinates.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<source>OpenMP threads:</source> <source>OpenMP threads</source>
<translation>OpenMP线</translation> <translation>OpenMP线</translation>
</message> </message>
<message> <message>
<source>ILU reuse steps:</source> <source>ILU reuse steps</source>
<translation>ILU</translation> <translation>ILU</translation>
</message> </message>
<message> <message>
<source>Use automatic settings</source> <source>Use automatic settings</source>

@ -111,10 +111,8 @@ private:
// 初始化UI组件的私有函数 // 初始化UI组件的私有函数
// 初始化主选项组 // 初始化主选项组
void initMainOptionsGroup(); void initMainOptionsGroup();
// 初始化查看井结果组 // 初始化模型与结果组
void initResultWellGroup(); void initModelAndResultGroup();
// 初始化当前模型显示组
void initCurrentModelGroup();
void initOutputGroup(); // 初始化输出组 (新) void initOutputGroup(); // 初始化输出组 (新)
void initAdvancedGroup(); // 初始化高级组 (新) void initAdvancedGroup(); // 初始化高级组 (新)
void initTimeSteppingGroup(); // 初始化时间步进组 void initTimeSteppingGroup(); // 初始化时间步进组
@ -159,13 +157,10 @@ private:
QPushButton* m_pResetDiagnosticButton; // "从诊断复位"按钮 (新) QPushButton* m_pResetDiagnosticButton; // "从诊断复位"按钮 (新)
QPushButton* m_pResetAnalyticalButton; // "从解析复位"按钮 (新) QPushButton* m_pResetAnalyticalButton; // "从解析复位"按钮 (新)
// 查看井结果切换控件 // 模型与结果切换控件
QGroupBox* m_pResultWellGroup; QGroupBox* m_pModelAndResultGroup;
QComboBox* m_pResultWellCombo; QComboBox* m_pResultWellCombo;
bool m_bFillingResultWellCombo; bool m_bFillingResultWellCombo;
// 当前模型切换控件
QGroupBox* m_pCurrentModelGroup;
QComboBox* m_pCurrentModelCombo; QComboBox* m_pCurrentModelCombo;
bool m_bFillingCurrentModelCombo; bool m_bFillingCurrentModelCombo;

@ -99,9 +99,8 @@ nmWxNumericalDesign::nmWxNumericalDesign(
// 设置当前实例为静态指针 // 设置当前实例为静态指针
s_pCurrentInstance = this; s_pCurrentInstance = this;
m_pResultWellGroup = nullptr; m_pModelAndResultGroup = nullptr;
m_pResultWellCombo = nullptr; m_pResultWellCombo = nullptr;
m_pCurrentModelGroup = nullptr;
m_pCurrentModelCombo = nullptr; m_pCurrentModelCombo = nullptr;
m_bFillingResultWellCombo = false; m_bFillingResultWellCombo = false;
m_bFillingCurrentModelCombo = false; m_bFillingCurrentModelCombo = false;
@ -127,8 +126,7 @@ nmWxNumericalDesign::nmWxNumericalDesign(
// 初始化所有UI组件 // 初始化所有UI组件
initMainOptionsGroup(); // 初始化主选项组 initMainOptionsGroup(); // 初始化主选项组
initResultWellGroup(); initModelAndResultGroup();
initCurrentModelGroup();
initOutputGroup(); // 初始化输出组 (新) initOutputGroup(); // 初始化输出组 (新)
initAdvancedGroup(); // 初始化高级组 (新) initAdvancedGroup(); // 初始化高级组 (新)
initTimeSteppingGroup(); // 初始化时间步进组 initTimeSteppingGroup(); // 初始化时间步进组
@ -138,8 +136,7 @@ nmWxNumericalDesign::nmWxNumericalDesign(
// 将各个组添加到滚动区域的布局中 // 将各个组添加到滚动区域的布局中
pScrollLayout->addWidget(m_pMainOptionsGroup); pScrollLayout->addWidget(m_pMainOptionsGroup);
pScrollLayout->addWidget(m_pResultWellGroup); pScrollLayout->addWidget(m_pModelAndResultGroup);
pScrollLayout->addWidget(m_pCurrentModelGroup);
pScrollLayout->addWidget(m_pOutputGroup); pScrollLayout->addWidget(m_pOutputGroup);
pScrollLayout->addWidget(m_pAdvancedGroup); pScrollLayout->addWidget(m_pAdvancedGroup);
pScrollLayout->addWidget(m_pTimeSteppingGroup); pScrollLayout->addWidget(m_pTimeSteppingGroup);
@ -250,43 +247,47 @@ void nmWxNumericalDesign::notifyResultWellSelectorChanged(const QString& wellNam
s_pCurrentInstance->fillResultWellCombo(wellName); s_pCurrentInstance->fillResultWellCombo(wellName);
} }
// 初始化查看井结果切换控件 // 初始化模型与结果切换控件
void nmWxNumericalDesign::initResultWellGroup() void nmWxNumericalDesign::initModelAndResultGroup()
{ {
m_pResultWellGroup = new QGroupBox(tr("View well result"), this); m_pModelAndResultGroup = new QGroupBox(tr("Model and result"), this);
QGridLayout* pGridLayout = new QGridLayout(m_pResultWellGroup); QGridLayout* pGridLayout = new QGridLayout(m_pModelAndResultGroup);
pGridLayout->setContentsMargins(8, 15, 8, 10);
QLabel* pCurrentWellLabel = new QLabel(tr("Current well:"), this); pGridLayout->setHorizontalSpacing(6);
m_pResultWellCombo = new QComboBox(this); pGridLayout->setVerticalSpacing(6);
fillResultWellCombo();
QLabel* pCurrentModelLabel = new QLabel(
pGridLayout->addWidget(pCurrentWellLabel, 0, 0, Qt::AlignLeft); tr("Current model"), m_pModelAndResultGroup);
pGridLayout->addWidget(m_pResultWellCombo, 0, 1); QLabel* pCurrentWellLabel = new QLabel(
pGridLayout->setColumnStretch(0, 0); tr("Current well"), m_pModelAndResultGroup);
pGridLayout->setColumnStretch(1, 1); pCurrentModelLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
pCurrentWellLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
m_pResultWellGroup->setLayout(pGridLayout);
m_pResultWellGroup->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); m_pCurrentModelCombo = new QComboBox(m_pModelAndResultGroup);
} m_pResultWellCombo = new QComboBox(m_pModelAndResultGroup);
QList<QComboBox*> listCombos;
// 初始化当前模型切换控件 listCombos << m_pCurrentModelCombo << m_pResultWellCombo;
void nmWxNumericalDesign::initCurrentModelGroup() for(int nIndex = 0; nIndex < listCombos.size(); ++nIndex) {
{ listCombos[nIndex]->setFixedHeight(nmParameterField::editorHeight());
m_pCurrentModelGroup = new QGroupBox(tr("Model selection"), this); listCombos[nIndex]->setMinimumWidth(
QGridLayout* pGridLayout = new QGridLayout(m_pCurrentModelGroup); nmParameterField::editorMinimumWidth());
listCombos[nIndex]->setSizePolicy(
QLabel* pCurrentModelLabel = new QLabel(tr("Current model:"), this); QSizePolicy::Expanding, QSizePolicy::Fixed);
m_pCurrentModelCombo = new QComboBox(this); }
// 按当前成果回填模型和结果井
updateCurrentModelDisplay(); updateCurrentModelDisplay();
fillResultWellCombo();
pGridLayout->addWidget(pCurrentModelLabel, 0, 0, Qt::AlignLeft); pGridLayout->addWidget(pCurrentModelLabel, 0, 0);
pGridLayout->addWidget(m_pCurrentModelCombo, 0, 1); pGridLayout->addWidget(m_pCurrentModelCombo, 0, 1);
pGridLayout->addWidget(pCurrentWellLabel, 1, 0);
pGridLayout->addWidget(m_pResultWellCombo, 1, 1);
pGridLayout->setColumnStretch(0, 0); pGridLayout->setColumnStretch(0, 0);
pGridLayout->setColumnStretch(1, 1); pGridLayout->setColumnStretch(1, 1);
m_pCurrentModelGroup->setLayout(pGridLayout); m_pModelAndResultGroup->setSizePolicy(
m_pCurrentModelGroup->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); QSizePolicy::Expanding, QSizePolicy::Preferred);
} }
// 按当前成果对应的数据管理器刷新模型下拉框选中项 // 按当前成果对应的数据管理器刷新模型下拉框选中项
@ -404,6 +405,9 @@ void nmWxNumericalDesign::initMainOptionsGroup()
{ {
m_pMainOptionsGroup = new QGroupBox(tr("Main options"), this); m_pMainOptionsGroup = new QGroupBox(tr("Main options"), this);
QGridLayout* pGridLayout = new QGridLayout(m_pMainOptionsGroup); // 使用 QGridLayout QGridLayout* pGridLayout = new QGridLayout(m_pMainOptionsGroup); // 使用 QGridLayout
pGridLayout->setContentsMargins(8, 15, 8, 10);
pGridLayout->setHorizontalSpacing(6);
pGridLayout->setVerticalSpacing(6);
// 第一行: Include other wells + Gear Icon (左侧), Reset from diagnostic (右侧) // 第一行: Include other wells + Gear Icon (左侧), Reset from diagnostic (右侧)
m_pIncludeOtherWellsCheck = new QCheckBox(tr("Include other wells"), this); m_pIncludeOtherWellsCheck = new QCheckBox(tr("Include other wells"), this);
@ -414,7 +418,9 @@ void nmWxNumericalDesign::initMainOptionsGroup()
m_pOptionsGearButton->setEnabled(m_pIncludeOtherWellsCheck->isChecked()); m_pOptionsGearButton->setEnabled(m_pIncludeOtherWellsCheck->isChecked());
m_pResetDiagnosticButton = new QPushButton(tr("Reset from diagnostic"), this); m_pResetDiagnosticButton = new QPushButton(tr("Reset from diagnostic"), this);
m_pResetDiagnosticButton->setFixedWidth(150); m_pResetDiagnosticButton->setFixedHeight(nmParameterField::editorHeight());
m_pResetDiagnosticButton->setSizePolicy(
QSizePolicy::Expanding, QSizePolicy::Fixed);
// 为左侧的复选框和齿轮创建一个QHBoxLayout以便它们可以紧密排列 // 为左侧的复选框和齿轮创建一个QHBoxLayout以便它们可以紧密排列
QHBoxLayout* pIncludeWellsLayout = new QHBoxLayout(); QHBoxLayout* pIncludeWellsLayout = new QHBoxLayout();
@ -423,17 +429,19 @@ void nmWxNumericalDesign::initMainOptionsGroup()
pIncludeWellsLayout->addStretch(); // 将它们推到左侧 pIncludeWellsLayout->addStretch(); // 将它们推到左侧
pGridLayout->addLayout(pIncludeWellsLayout, 0, 0, Qt::AlignLeft); // 第0行第0列左对齐 pGridLayout->addLayout(pIncludeWellsLayout, 0, 0, Qt::AlignLeft); // 第0行第0列左对齐
pGridLayout->addWidget(m_pResetDiagnosticButton, 0, 1, Qt::AlignLeft); // 第0行第1列左对齐 pGridLayout->addWidget(m_pResetDiagnosticButton, 0, 1);
// 第二行: Impose pi (左侧), Reset from analytical (右侧) // 第二行: Impose pi (左侧), Reset from analytical (右侧)
m_pImposePiCheck = new QCheckBox(tr("Impose pi"), this); m_pImposePiCheck = new QCheckBox(tr("Impose pi"), this);
m_pImposePiCheck->setChecked(true); // 默认选中 m_pImposePiCheck->setChecked(true); // 默认选中
m_pResetAnalyticalButton = new QPushButton(tr("Reset from analytical"), this); m_pResetAnalyticalButton = new QPushButton(tr("Reset from analytical"), this);
m_pResetAnalyticalButton->setFixedWidth(150); m_pResetAnalyticalButton->setFixedHeight(nmParameterField::editorHeight());
m_pResetAnalyticalButton->setSizePolicy(
QSizePolicy::Expanding, QSizePolicy::Fixed);
pGridLayout->addWidget(m_pImposePiCheck, 1, 0, Qt::AlignLeft); // 第1行第0列左对齐 pGridLayout->addWidget(m_pImposePiCheck, 1, 0, Qt::AlignLeft); // 第1行第0列左对齐
pGridLayout->addWidget(m_pResetAnalyticalButton, 1, 1, Qt::AlignLeft); // 第1行第1列左对齐 pGridLayout->addWidget(m_pResetAnalyticalButton, 1, 1);
// 第三行: Show average pressure (左侧), 右侧留空 // 第三行: Show average pressure (左侧), 右侧留空
m_pShowAveragePressureCheck = new QCheckBox(tr("Show average pressure"), this); m_pShowAveragePressureCheck = new QCheckBox(tr("Show average pressure"), this);
@ -654,10 +662,13 @@ void nmWxNumericalDesign::initPebiSolverSettingsGroup()
{ {
m_pPebiSolverSettingsGroup = new QGroupBox(tr("Solver settings"), this); m_pPebiSolverSettingsGroup = new QGroupBox(tr("Solver settings"), this);
QGridLayout* pGridLayout = new QGridLayout(m_pPebiSolverSettingsGroup); QGridLayout* pGridLayout = new QGridLayout(m_pPebiSolverSettingsGroup);
pGridLayout->setContentsMargins(8, 15, 8, 10);
pGridLayout->setHorizontalSpacing(6);
pGridLayout->setVerticalSpacing(6);
QLabel* pSolverTypeLabel = new QLabel(tr("Solver library:"), this); QLabel* pSolverTypeLabel = new QLabel(tr("Solver library"), this);
QLabel* pOmpThreadsLabel = new QLabel(tr("OpenMP threads:"), this); QLabel* pOmpThreadsLabel = new QLabel(tr("OpenMP threads"), this);
QLabel* pIluReuseStepsLabel = new QLabel(tr("ILU reuse steps:"), this); QLabel* pIluReuseStepsLabel = new QLabel(tr("ILU reuse steps"), this);
pSolverTypeLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); pSolverTypeLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
pOmpThreadsLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); pOmpThreadsLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
pIluReuseStepsLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); pIluReuseStepsLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
@ -678,6 +689,22 @@ void nmWxNumericalDesign::initPebiSolverSettingsGroup()
m_pPebiIluReuseStepsSpin = new QSpinBox(this); m_pPebiIluReuseStepsSpin = new QSpinBox(this);
m_pPebiIluReuseStepsSpin->setRange(1, 100); m_pPebiIluReuseStepsSpin->setRange(1, 100);
m_pPebiSolverTypeCombo->setFixedHeight(nmParameterField::editorHeight());
m_pPebiOmpThreadsCombo->setFixedHeight(nmParameterField::editorHeight());
m_pPebiIluReuseStepsSpin->setFixedHeight(nmParameterField::editorHeight());
m_pPebiSolverTypeCombo->setMinimumWidth(
nmParameterField::editorMinimumWidth());
m_pPebiOmpThreadsCombo->setMinimumWidth(
nmParameterField::editorMinimumWidth());
m_pPebiIluReuseStepsSpin->setMinimumWidth(
nmParameterField::editorMinimumWidth());
m_pPebiSolverTypeCombo->setSizePolicy(
QSizePolicy::Expanding, QSizePolicy::Fixed);
m_pPebiOmpThreadsCombo->setSizePolicy(
QSizePolicy::Expanding, QSizePolicy::Fixed);
m_pPebiIluReuseStepsSpin->setSizePolicy(
QSizePolicy::Expanding, QSizePolicy::Fixed);
pGridLayout->addWidget(pSolverTypeLabel, 0, 0); pGridLayout->addWidget(pSolverTypeLabel, 0, 0);
pGridLayout->addWidget(m_pPebiSolverTypeCombo, 0, 1); pGridLayout->addWidget(m_pPebiSolverTypeCombo, 0, 1);
pGridLayout->addWidget(pOmpThreadsLabel, 1, 0); pGridLayout->addWidget(pOmpThreadsLabel, 1, 0);

Loading…
Cancel
Save