From 755ed34b179f8f9dcd958c546af771c569979965 Mon Sep 17 00:00:00 2001 From: lh <2334563547@qq.com> Date: Tue, 8 Sep 2026 16:45:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(nmSubWxs):=20=E7=BB=9F=E4=B8=80=E5=8C=85?= =?UTF-8?q?=E5=90=AB=E4=BA=95=E5=AF=B9=E8=AF=9D=E6=A1=86=E5=BA=95=E9=83=A8?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 增加带图标的帮助按钮并接入系统帮助 - 为确定和取消按钮增加平台标准图标 - 使用标准按钮框统一底部布局 - 移除标题栏帮助按钮并补充中文翻译 --- .../nmNum/nmSubWxs/nmWxIncludeOtherWells.h | 8 +++- Src/nmNum/nmSubWxs/nmWxIncludeOtherWells.cpp | 45 +++++++++++++++---- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/Include/nmNum/nmSubWxs/nmWxIncludeOtherWells.h b/Include/nmNum/nmSubWxs/nmWxIncludeOtherWells.h index dbce8ea..d349a0b 100644 --- a/Include/nmNum/nmSubWxs/nmWxIncludeOtherWells.h +++ b/Include/nmNum/nmSubWxs/nmWxIncludeOtherWells.h @@ -14,6 +14,8 @@ #include class nmDataAnalyzeManager; +class QDialogButtonBox; +class QToolButton; /** * @brief Include Other Wells 表格的一行候选井数据。 @@ -76,7 +78,7 @@ private: void initUI(); /** @brief 从所属数据管理器收集候选主动井并建立表格。 */ void setupTable(); - /** @brief 创建确定和取消按钮。 */ + /** @brief 创建帮助及带图标的确定、取消按钮。 */ void setupButtons(); /** @brief 组装表格与底部按钮布局。 */ void setupLayouts(); @@ -104,6 +106,8 @@ private: const WellDataRow& data) const; private slots: + /** @brief 打开系统帮助文档。 */ + void slotHelp(); /** @brief 把复选框状态同步回对应的 WellDataRow。 */ void onCheckBoxStateChanged(int state); /** @brief 切换某一相使用的流量记录;其他已选相同步到同一记录。 */ @@ -117,6 +121,8 @@ private: /** @brief 当前对话框所属的数据管理器,不拥有对象。 */ nmDataAnalyzeManager* m_pDataManager; QTableWidget* m_pTableWidget; ///< 其他有产量井及其数据摘要表格。 + QToolButton* m_pFooterHelpButton; ///< 底部帮助命令。 + QDialogButtonBox* m_pButtonBox; ///< 确定和取消按钮区。 QPushButton* m_pOkButton; ///< 提交当前勾选状态的确定按钮。 QPushButton* m_pCancelButton; ///< 放弃本次编辑的取消按钮。 QHBoxLayout* m_pButtonLayout; ///< 底部操作按钮布局。 diff --git a/Src/nmNum/nmSubWxs/nmWxIncludeOtherWells.cpp b/Src/nmNum/nmSubWxs/nmWxIncludeOtherWells.cpp index 023a5e9..adb52e9 100644 --- a/Src/nmNum/nmSubWxs/nmWxIncludeOtherWells.cpp +++ b/Src/nmNum/nmSubWxs/nmWxIncludeOtherWells.cpp @@ -1,14 +1,17 @@ #include "nmWxIncludeOtherWells.h" #include "nmDataAnalyzeManager.h" #include "nmDataWellBase.h" +#include "ZxBaseUtil.h" #include #include #include #include +#include #include #include #include +#include #include namespace @@ -244,6 +247,7 @@ nmWxIncludeOtherWells::nmWxIncludeOtherWells( nmDataAnalyzeManager* pDataManager, QWidget* pParent) : iDlgBase(pParent), m_pDataManager(pDataManager), m_pTableWidget(nullptr), + m_pFooterHelpButton(nullptr), m_pButtonBox(nullptr), m_pOkButton(nullptr), m_pCancelButton(nullptr), m_pButtonLayout(nullptr), m_pMainLayout(nullptr) { @@ -263,6 +267,7 @@ void nmWxIncludeOtherWells::initUI() this->setupConnections(); this->setWindowTitle(tr("Include Other Wells")); + this->setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); // 初始尺寸跟随列宽和井数量,手动缩小时仍由滚动条保护表头及下拉内容。 this->setMinimumSize(720, 240); this->adjustDialogSizeToTable(); @@ -486,8 +491,9 @@ void nmWxIncludeOtherWells::adjustDialogSizeToTable() int nBottom = 0; m_pMainLayout->getContentsMargins(&nLeft, &nTop, &nRight, &nBottom); const int nLayoutWidth = nLeft + nRight; - const int nButtonHeight = qMax(m_pOkButton->sizeHint().height(), - m_pCancelButton->sizeHint().height()); + const int nButtonHeight = qMax(m_pFooterHelpButton->sizeHint().height(), + qMax(m_pOkButton->sizeHint().height(), + m_pCancelButton->sizeHint().height())); const int nLayoutHeight = nTop + nBottom + nButtonHeight + m_pMainLayout->spacing(); @@ -845,16 +851,33 @@ QVector nmWxIncludeOtherWells::getWellData() const void nmWxIncludeOtherWells::setupButtons() { - m_pOkButton = new QPushButton(tr("OK"), this); - m_pCancelButton = new QPushButton(tr("Cancel"), this); + m_pFooterHelpButton = new QToolButton(this); + m_pFooterHelpButton->setText(tr("Help")); + m_pFooterHelpButton->setIcon(zxLoadIcon("Help")); + m_pFooterHelpButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + m_pFooterHelpButton->setAutoRaise(true); + + m_pButtonBox = new QDialogButtonBox( + QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + Qt::Horizontal, this); + m_pOkButton = m_pButtonBox->button(QDialogButtonBox::Ok); + m_pCancelButton = m_pButtonBox->button(QDialogButtonBox::Cancel); + if(m_pOkButton != nullptr) { + m_pOkButton->setIcon(zxLoadIcon("OK")); + m_pOkButton->setText(tr("OK")); + } + if(m_pCancelButton != nullptr) { + m_pCancelButton->setIcon(zxLoadIcon("Cancel")); + m_pCancelButton->setText(tr("Cancel")); + } } void nmWxIncludeOtherWells::setupLayouts() { m_pButtonLayout = new QHBoxLayout(); + m_pButtonLayout->addWidget(m_pFooterHelpButton); m_pButtonLayout->addStretch(); - m_pButtonLayout->addWidget(m_pOkButton); - m_pButtonLayout->addWidget(m_pCancelButton); + m_pButtonLayout->addWidget(m_pButtonBox); m_pMainLayout = new QVBoxLayout(this); m_pMainLayout->addWidget(m_pTableWidget, 1); @@ -864,6 +887,12 @@ void nmWxIncludeOtherWells::setupLayouts() void nmWxIncludeOtherWells::setupConnections() { - connect(m_pOkButton, SIGNAL(clicked()), this, SLOT(accept())); - connect(m_pCancelButton, SIGNAL(clicked()), this, SLOT(reject())); + connect(m_pFooterHelpButton, SIGNAL(clicked()), this, SLOT(slotHelp())); + connect(m_pButtonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(m_pButtonBox, SIGNAL(rejected()), this, SLOT(reject())); +} + +void nmWxIncludeOtherWells::slotHelp() +{ + ZxBaseUtil::startHelp(); }