|
|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
|
|
|
|
|
#include "iUnitGroup.h"
|
|
|
|
|
#include "iUnitHelper.h"
|
|
|
|
|
#include "ZxBaseUtil.h"
|
|
|
|
|
#include "nmDataAnalyzeManager.h"
|
|
|
|
|
#include "nmFFmpegVideoWriter.h"
|
|
|
|
|
#include "nmPebiRegionPressureCalculator.h"
|
|
|
|
|
@ -42,6 +43,7 @@
|
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
#include <QDir>
|
|
|
|
|
#include <QFontMetrics>
|
|
|
|
|
#include <QGridLayout>
|
|
|
|
|
#include <QGroupBox>
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
@ -76,6 +78,26 @@
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
// 筛选范围沿用颜色设置及储层参数的数值/单位列伸展比例。
|
|
|
|
|
const int s_nFilterValueStretch = 8;
|
|
|
|
|
const int s_nFilterUnitStretch = 5;
|
|
|
|
|
|
|
|
|
|
/** @brief 按完整列表测量推荐字符宽度,由布局分配实际宽度,避免下拉框延迟自行 resize。 */
|
|
|
|
|
void updateFilterComboContentsLength(QComboBox* pCombo)
|
|
|
|
|
{
|
|
|
|
|
// Qt 4.8 的 AdjustToContents 会启动 20ms 定时器并直接 adjustSize,
|
|
|
|
|
// 容易在对话框显示后覆盖布局分配的宽度;改用字符宽度策略保留主题边框和箭头尺寸。
|
|
|
|
|
const QFontMetrics metrics = pCombo->fontMetrics();
|
|
|
|
|
int nTextWidth = 0;
|
|
|
|
|
for(int nIndex = 0; nIndex < pCombo->count(); ++nIndex) {
|
|
|
|
|
nTextWidth = qMax(nTextWidth, metrics.boundingRect(pCombo->itemText(nIndex)).width());
|
|
|
|
|
}
|
|
|
|
|
// 使用实测像素宽度折算,中文属性名不能直接按字符串字符个数估算。
|
|
|
|
|
const int nCharacterWidth = qMax(1, metrics.width(QLatin1Char('X')));
|
|
|
|
|
pCombo->setMinimumContentsLength(qMax(1,
|
|
|
|
|
(nTextWidth + nCharacterWidth - 1) / nCharacterWidth));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @brief 当前视图专用的切片按钮,绘制时省略菜单箭头,交互沿用 QToolButton。 */
|
|
|
|
|
class nmWxVolumeSliceToolButton : public QToolButton
|
|
|
|
|
{
|
|
|
|
|
@ -331,6 +353,7 @@ nmWxPebiResultFilterSettingsDlg::nmWxPebiResultFilterSettingsDlg(
|
|
|
|
|
m_nExpectedDisplayFrameIndex(-1),
|
|
|
|
|
m_pUnitGroup(nullptr),
|
|
|
|
|
m_bInitialized(false),
|
|
|
|
|
m_pFieldsLayout(nullptr),
|
|
|
|
|
m_pEnableCheck(nullptr),
|
|
|
|
|
m_pPropertyCombo(nullptr),
|
|
|
|
|
m_pMinimumCheck(nullptr),
|
|
|
|
|
@ -341,8 +364,11 @@ nmWxPebiResultFilterSettingsDlg::nmWxPebiResultFilterSettingsDlg(
|
|
|
|
|
m_pApplyButton(nullptr),
|
|
|
|
|
m_pOkButton(nullptr)
|
|
|
|
|
{
|
|
|
|
|
m_dEditorBaseRange[0] = m_dEditorBaseRange[1] = 0.0;
|
|
|
|
|
createUi();
|
|
|
|
|
m_bInitialized = initializeFromScene();
|
|
|
|
|
// 初始列表填充后同步确定推荐宽度,首次显示后不再由下拉框自行改尺寸。
|
|
|
|
|
updateFilterComboContentsLength(m_pPropertyCombo);
|
|
|
|
|
if(!m_bInitialized) {
|
|
|
|
|
m_pApplyButton->setEnabled(false);
|
|
|
|
|
m_pOkButton->setEnabled(false);
|
|
|
|
|
@ -350,6 +376,8 @@ nmWxPebiResultFilterSettingsDlg::nmWxPebiResultFilterSettingsDlg(
|
|
|
|
|
this, tr("Filtering settings"),
|
|
|
|
|
tr("Unable to read the current result filter settings."));
|
|
|
|
|
}
|
|
|
|
|
// 属性及单位列表填充完毕后按主题推荐值确定初始尺寸,不固定窗口宽度。
|
|
|
|
|
adjustSize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nmWxPebiResultFilterSettingsDlg::~nmWxPebiResultFilterSettingsDlg()
|
|
|
|
|
@ -362,83 +390,103 @@ void nmWxPebiResultFilterSettingsDlg::createUi()
|
|
|
|
|
setModal(true);
|
|
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
|
|
|
|
|
|
m_dEditorBaseRange[0] = m_dEditorBaseRange[1] = 0.0;
|
|
|
|
|
m_pEnableCheck = new QCheckBox(tr("Enable filtering"), this);
|
|
|
|
|
// 与颜色设置统一外边距和底栏;纵向余量由表单下方空间吸收。
|
|
|
|
|
QVBoxLayout* pMainLayout = new QVBoxLayout(this);
|
|
|
|
|
pMainLayout->setContentsMargins(12, 10, 12, 0);
|
|
|
|
|
pMainLayout->setSpacing(10);
|
|
|
|
|
pMainLayout->addWidget(createFields());
|
|
|
|
|
pMainLayout->addStretch(1);
|
|
|
|
|
pMainLayout->addWidget(createFooter());
|
|
|
|
|
connectUiSignals();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QWidget* nmWxPebiResultFilterSettingsDlg::createFields()
|
|
|
|
|
{
|
|
|
|
|
QWidget* pFields = new QWidget(this);
|
|
|
|
|
pFields->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
|
|
|
m_pFieldsLayout = new QGridLayout(pFields);
|
|
|
|
|
m_pFieldsLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
m_pFieldsLayout->setHorizontalSpacing(6);
|
|
|
|
|
m_pFieldsLayout->setVerticalSpacing(6);
|
|
|
|
|
m_pFieldsLayout->setColumnStretch(1, s_nFilterValueStretch);
|
|
|
|
|
|
|
|
|
|
m_pEnableCheck = new QCheckBox(tr("Enable filtering"), pFields);
|
|
|
|
|
m_pEnableCheck->setObjectName(QLatin1String("filterEnabledCheck"));
|
|
|
|
|
m_pPropertyCombo = new QComboBox(this);
|
|
|
|
|
m_pPropertyCombo->setSizeAdjustPolicy(
|
|
|
|
|
QComboBox::AdjustToContentsOnFirstShow);
|
|
|
|
|
m_pPropertyCombo->setMinimumWidth(220);
|
|
|
|
|
m_pPropertyCombo = new QComboBox(pFields);
|
|
|
|
|
m_pPropertyCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
|
|
|
|
|
m_pPropertyCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
|
|
|
QLabel* pPropertyLabel = new QLabel(tr("Filter on"), pFields);
|
|
|
|
|
pPropertyLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
|
|
|
|
|
|
|
|
|
m_pMinimumCheck = new QCheckBox(tr("Above min (>=)"), this);
|
|
|
|
|
m_pMinimumEdit = new QLineEdit(this);
|
|
|
|
|
m_pMinimumCheck = new QCheckBox(tr("Above min (>=)"), pFields);
|
|
|
|
|
m_pMinimumEdit = new QLineEdit(pFields);
|
|
|
|
|
m_pMinimumEdit->setObjectName(QLatin1String("filterMinimumEdit"));
|
|
|
|
|
m_pMinimumEdit->setAlignment(Qt::AlignRight);
|
|
|
|
|
m_pMaximumCheck = new QCheckBox(tr("Below max (<=)"), this);
|
|
|
|
|
m_pMaximumEdit = new QLineEdit(this);
|
|
|
|
|
m_pMinimumEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
|
|
|
m_pMaximumCheck = new QCheckBox(tr("Below max (<=)"), pFields);
|
|
|
|
|
m_pMaximumEdit = new QLineEdit(pFields);
|
|
|
|
|
m_pMaximumEdit->setObjectName(QLatin1String("filterMaximumEdit"));
|
|
|
|
|
m_pMaximumEdit->setAlignment(Qt::AlignRight);
|
|
|
|
|
m_pUnitCombo = new QComboBox(this);
|
|
|
|
|
m_pMaximumEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
|
|
|
|
|
|
|
|
// 上下限共用一个单位框,宽度跟随表单伸展,高度采用主题推荐值。
|
|
|
|
|
// 属性切换会重建单位列表,按完整列表重新计算所需宽度。
|
|
|
|
|
m_pUnitCombo = new QComboBox(pFields);
|
|
|
|
|
m_pUnitCombo->setObjectName(QLatin1String("filterUnitCombo"));
|
|
|
|
|
m_pUnitCombo->setMinimumWidth(80);
|
|
|
|
|
m_pUnitCombo->setMaximumWidth(140);
|
|
|
|
|
m_pUnitCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
|
|
|
|
|
m_pUnitCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
|
|
|
m_pUnitCombo->hide();
|
|
|
|
|
m_pMinimumEdit->setMinimumWidth(150);
|
|
|
|
|
m_pMaximumEdit->setMinimumWidth(150);
|
|
|
|
|
|
|
|
|
|
QGridLayout* pFieldsLayout = new QGridLayout();
|
|
|
|
|
pFieldsLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
pFieldsLayout->setHorizontalSpacing(8);
|
|
|
|
|
pFieldsLayout->setVerticalSpacing(6);
|
|
|
|
|
pFieldsLayout->addWidget(m_pEnableCheck, 0, 0, 1, 3);
|
|
|
|
|
QLabel* pPropertyLabel = new QLabel(tr("Filter on"), this);
|
|
|
|
|
pPropertyLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
|
|
|
|
pFieldsLayout->addWidget(pPropertyLabel, 1, 0);
|
|
|
|
|
pFieldsLayout->addWidget(m_pPropertyCombo, 1, 1, 1, 2);
|
|
|
|
|
pFieldsLayout->addWidget(m_pMinimumCheck, 2, 0);
|
|
|
|
|
pFieldsLayout->addWidget(m_pMinimumEdit, 2, 1);
|
|
|
|
|
pFieldsLayout->addWidget(m_pUnitCombo, 2, 2, 2, 1,
|
|
|
|
|
Qt::AlignVCenter);
|
|
|
|
|
pFieldsLayout->addWidget(m_pMaximumCheck, 3, 0);
|
|
|
|
|
pFieldsLayout->addWidget(m_pMaximumEdit, 3, 1);
|
|
|
|
|
pFieldsLayout->setColumnStretch(1, 1);
|
|
|
|
|
|
|
|
|
|
// 普通布局不受平台按钮顺序策略影响,始终保持应用、确定、取消。
|
|
|
|
|
QHBoxLayout* pButtonLayout = new QHBoxLayout();
|
|
|
|
|
pButtonLayout->addStretch();
|
|
|
|
|
m_pApplyButton = new QPushButton(tr("Apply"), this);
|
|
|
|
|
m_pOkButton = new QPushButton(tr("OK"), this);
|
|
|
|
|
QPushButton* pCancelButton = new QPushButton(tr("Cancel"), this);
|
|
|
|
|
const QSize oFooterIconSize(16, 16);
|
|
|
|
|
m_pOkButton->setIcon(QIcon(resultViewIconPath("OK.png")));
|
|
|
|
|
pCancelButton->setIcon(QIcon(resultViewIconPath("Cancel.png")));
|
|
|
|
|
m_pOkButton->setIconSize(oFooterIconSize);
|
|
|
|
|
pCancelButton->setIconSize(oFooterIconSize);
|
|
|
|
|
m_pApplyButton->setMinimumWidth(72);
|
|
|
|
|
m_pOkButton->setMinimumWidth(72);
|
|
|
|
|
pCancelButton->setMinimumWidth(72);
|
|
|
|
|
m_pFieldsLayout->addWidget(m_pEnableCheck, 0, 0, 1, 3);
|
|
|
|
|
m_pFieldsLayout->addWidget(pPropertyLabel, 1, 0);
|
|
|
|
|
m_pFieldsLayout->addWidget(m_pPropertyCombo, 1, 1, 1, 2);
|
|
|
|
|
m_pFieldsLayout->addWidget(m_pMinimumCheck, 2, 0);
|
|
|
|
|
m_pFieldsLayout->addWidget(m_pMinimumEdit, 2, 1);
|
|
|
|
|
m_pFieldsLayout->addWidget(m_pMaximumCheck, 3, 0);
|
|
|
|
|
m_pFieldsLayout->addWidget(m_pMaximumEdit, 3, 1);
|
|
|
|
|
m_pFieldsLayout->addWidget(m_pUnitCombo, 2, 2, 2, 1, Qt::AlignVCenter);
|
|
|
|
|
updateUnitColumnStretch();
|
|
|
|
|
return pFields;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QWidget* nmWxPebiResultFilterSettingsDlg::createFooter()
|
|
|
|
|
{
|
|
|
|
|
QWidget* pFooter = new QWidget(this);
|
|
|
|
|
pFooter->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
|
|
|
|
QHBoxLayout* pLayout = new QHBoxLayout(pFooter);
|
|
|
|
|
pLayout->setContentsMargins(4, 5, 4, 5);
|
|
|
|
|
pLayout->setSpacing(8);
|
|
|
|
|
pLayout->addStretch();
|
|
|
|
|
m_pApplyButton = new QPushButton(tr("Apply"), pFooter);
|
|
|
|
|
m_pOkButton = new QPushButton(tr("OK"), pFooter);
|
|
|
|
|
QPushButton* pCancelButton = new QPushButton(tr("Cancel"), pFooter);
|
|
|
|
|
m_pOkButton->setIcon(zxLoadIcon("OK"));
|
|
|
|
|
pCancelButton->setIcon(zxLoadIcon("Cancel"));
|
|
|
|
|
m_pApplyButton->setAutoDefault(false);
|
|
|
|
|
m_pOkButton->setDefault(true);
|
|
|
|
|
pCancelButton->setAutoDefault(false);
|
|
|
|
|
pButtonLayout->setContentsMargins(4, 2, 4, 5);
|
|
|
|
|
pButtonLayout->setSpacing(6);
|
|
|
|
|
pButtonLayout->addWidget(m_pApplyButton);
|
|
|
|
|
pButtonLayout->addWidget(m_pOkButton);
|
|
|
|
|
pButtonLayout->addWidget(pCancelButton);
|
|
|
|
|
|
|
|
|
|
QVBoxLayout* pMainLayout = new QVBoxLayout(this);
|
|
|
|
|
pMainLayout->setContentsMargins(12, 10, 12, 0);
|
|
|
|
|
pMainLayout->setSpacing(8);
|
|
|
|
|
pMainLayout->addLayout(pFieldsLayout);
|
|
|
|
|
pMainLayout->addLayout(pButtonLayout);
|
|
|
|
|
setMinimumWidth(430);
|
|
|
|
|
|
|
|
|
|
connect(m_pApplyButton, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(onApplyClicked()));
|
|
|
|
|
connect(m_pOkButton, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(onOkClicked()));
|
|
|
|
|
connect(pCancelButton, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(reject()));
|
|
|
|
|
// 与颜色设置保持相同顺序,应用位于确定左侧,按钮组整体靠右。
|
|
|
|
|
pLayout->addWidget(m_pApplyButton);
|
|
|
|
|
pLayout->addWidget(m_pOkButton);
|
|
|
|
|
pLayout->addWidget(pCancelButton);
|
|
|
|
|
connect(m_pApplyButton, SIGNAL(clicked()), this, SLOT(onApplyClicked()));
|
|
|
|
|
connect(m_pOkButton, SIGNAL(clicked()), this, SLOT(onOkClicked()));
|
|
|
|
|
connect(pCancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
|
|
|
|
|
|
|
|
|
// 每个边界开关紧接对应输入框,隐藏或禁用的字段由 Qt 自动跳过。
|
|
|
|
|
setTabOrder(m_pEnableCheck, m_pPropertyCombo);
|
|
|
|
|
setTabOrder(m_pPropertyCombo, m_pMinimumCheck);
|
|
|
|
|
setTabOrder(m_pMinimumCheck, m_pMinimumEdit);
|
|
|
|
|
setTabOrder(m_pMinimumEdit, m_pMaximumCheck);
|
|
|
|
|
setTabOrder(m_pMaximumCheck, m_pMaximumEdit);
|
|
|
|
|
setTabOrder(m_pMaximumEdit, m_pUnitCombo);
|
|
|
|
|
setTabOrder(m_pUnitCombo, m_pApplyButton);
|
|
|
|
|
setTabOrder(m_pApplyButton, m_pOkButton);
|
|
|
|
|
setTabOrder(m_pOkButton, pCancelButton);
|
|
|
|
|
return pFooter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxPebiResultFilterSettingsDlg::connectUiSignals()
|
|
|
|
|
{
|
|
|
|
|
connect(m_pPropertyCombo, SIGNAL(currentIndexChanged(int)),
|
|
|
|
|
this, SLOT(onPropertyChanged(int)));
|
|
|
|
|
connect(m_pUnitCombo, SIGNAL(currentIndexChanged(int)),
|
|
|
|
|
@ -453,6 +501,14 @@ void nmWxPebiResultFilterSettingsDlg::createUi()
|
|
|
|
|
this, SLOT(refreshEditorEnabledState()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nmWxPebiResultFilterSettingsDlg::updateUnitColumnStretch()
|
|
|
|
|
{
|
|
|
|
|
// 用显式隐藏状态判断,窗口首次 show 前也能正确计算单位列是否占宽。
|
|
|
|
|
// 只更新布局,不修改属性、显示单位或上下限草稿。
|
|
|
|
|
m_pFieldsLayout->setColumnStretch(2,
|
|
|
|
|
m_pUnitCombo->isHidden() ? 0 : s_nFilterUnitStretch);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool nmWxPebiResultFilterSettingsDlg::initializeFromScene()
|
|
|
|
|
{
|
|
|
|
|
if(m_pSceneController == nullptr || m_pControlBar == nullptr ||
|
|
|
|
|
@ -533,6 +589,7 @@ bool nmWxPebiResultFilterSettingsDlg::initializeUnitEditor(
|
|
|
|
|
m_sDisplayUnit.clear();
|
|
|
|
|
m_pUnitCombo->setEnabled(false);
|
|
|
|
|
m_pUnitCombo->hide();
|
|
|
|
|
updateUnitColumnStretch();
|
|
|
|
|
m_pUnitCombo->blockSignals(bSignalsBlocked);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@ -555,10 +612,13 @@ bool nmWxPebiResultFilterSettingsDlg::initializeUnitEditor(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_pUnitCombo->addItems(listUnits);
|
|
|
|
|
// 属性切换时同步更新单位列表的推荐宽度,仍由表单按 8:5 分配实际空间。
|
|
|
|
|
updateFilterComboContentsLength(m_pUnitCombo);
|
|
|
|
|
m_pUnitCombo->setCurrentIndex(
|
|
|
|
|
m_pUnitCombo->findText(m_sDisplayUnit));
|
|
|
|
|
m_pUnitCombo->setEnabled(bHasUnitGroup);
|
|
|
|
|
m_pUnitCombo->show();
|
|
|
|
|
updateUnitColumnStretch();
|
|
|
|
|
m_pUnitCombo->blockSignals(bSignalsBlocked);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|