feat(nmSubWxs): 支持井记录预览切换并完善曲线提示

- 支持编辑井切换压力和流量记录进行预览
- 完善编辑井及包含井的曲线 Tooltip 信息
- 移除编辑井预览下拉中的无效“无”选项
feature/nmNum-multi-gauge-record
lh 4 weeks ago
parent 84367bc46d
commit ffd947b39a

Binary file not shown.

@ -5220,6 +5220,9 @@ Please check your input coordinates.</source>
<message><source>Unknown</source><translation>未知</translation></message>
<message><source>None</source><translation>无</translation></message>
<message><source>(unnamed)</source><translation>(未命名)</translation></message>
<message><source>Curve name: %1</source><translation>曲线名称:%1</translation></message>
<message><source>Gauge Code: %1</source><translation>记录编号:%1</translation></message>
<message><source>Measurement time: %1</source><translation>测量时间:%1</translation></message>
<message><source> (Empty)</source><translation>(空)</translation></message>
<message><source> (Corrupt)</source><translation>(损坏)</translation></message>
<message><source> (Invalid)</source><translation>(无效)</translation></message>
@ -7213,7 +7216,11 @@ Average pressure in contour: %2 MPa</source>
<message><source>Pressure Record</source><translation>压力记录</translation></message>
<message><source>Flow Record</source><translation>流量记录</translation></message>
<message><source>Display Phase</source><translation>显示相</translation></message>
<message><source>This page only displays the selected record.</source><translation>此页面仅展示当前选中的记录。</translation></message>
<message><source>(unnamed)</source><translation>(未命名)</translation></message>
<message><source>Curve name: %1</source><translation>曲线名称:%1</translation></message>
<message><source>Gauge Code: %1</source><translation>记录编号:%1</translation></message>
<message><source>Measurement time: %1</source><translation>测量时间:%1</translation></message>
<message><source>Preview only; calculation settings are unchanged.</source><translation>仅切换页面预览,不影响计算配置。</translation></message>
<message><source> (Invalid)</source><translation> (无效)</translation></message>
<message><source> (Empty)</source><translation> (空)</translation></message>
<message><source> (Corrupt)</source><translation> (损坏)</translation></message>

@ -59,6 +59,12 @@ private slots:
/** @brief 将流量曲线点击时间映射为表格行选择。 */
void slotFlowChartPointClicked(double dTimePoint);
/** @brief 切换压力记录预览,仅刷新页面,不修改井的计算记录选择。 */
void slotPressureGaugePreviewChanged(int nIndex);
/** @brief 切换流量记录预览,仅刷新页面,不修改井的计算记录选择。 */
void slotFlowGaugePreviewChanged(int nIndex);
/** @brief 切换显示相下拉框,仅重新按新相取点刷新视图,不改变井数据。 */
void slotDisplayPhaseChanged(int nIndex);
@ -72,10 +78,10 @@ private:
/** @brief 创建顶部压力/流量记录与显示相三个下拉框所在行。 */
void createRecordSelectionBar();
/** @brief 按 m_pWell->getPressureRecords() 填充压力记录下拉框,恢复当前选中项。 */
/** @brief 填充压力记录预览下拉框,优先恢复页面预览项。 */
void populatePressureGaugeCombo();
/** @brief 按 m_pWell->getFlowRecords() 填充流量记录下拉框,恢复当前选中项。 */
/** @brief 填充流量记录预览下拉框,优先恢复页面预览项。 */
void populateFlowGaugeCombo();
/** @brief 按当前选中流量记录的真实相填充显示相下拉框;至多 1 项时隐藏整行。 */
@ -84,7 +90,10 @@ private:
/** @brief 返回记录的默认显示相:优先井别参考相,否则记录中第一个有真实数据的相。 */
NM_PHASE_TYPE defaultDisplayPhase(const nmFlowGaugeRecord* pRecord) const;
/** @brief 按 m_pWell->getSelectedFlowGaugeCode() 在流量记录列表中查找当前选中记录。 */
/** @brief 在缓存中查找当前预览的压力记录。 */
const nmPressureGaugeRecord* currentPressureRecord() const;
/** @brief 在缓存中查找当前预览的流量记录。 */
const nmFlowGaugeRecord* currentFlowRecord() const;
/** @brief 重新获取框架单位组并同步双行表头。 */
@ -162,11 +171,14 @@ private:
int m_nSelectedFlowSegment;
QWidget* m_pRecordSelectionBar; ///< 顶部压力/流量记录与显示相下拉框所在行容器。
QComboBox* m_pPressureGaugeCombo; ///< 当前压力记录只读展示,itemData 存 Gauge Code。
QComboBox* m_pFlowGaugeCombo; ///< 当前流量记录只读展示,itemData 存 Gauge Code。
QComboBox* m_pPressureGaugeCombo; ///< 压力记录预览选择,itemData 存 Gauge Code。
QComboBox* m_pFlowGaugeCombo; ///< 流量记录预览选择,itemData 存 Gauge Code。
QComboBox* m_pDisplayPhaseCombo; ///< 显示相下拉框,itemData 存 NM_PHASE_TYPE。
QWidget* m_pDisplayPhaseContainer; ///< 承载显示相下拉框与标签,整体隐藏用。
QPushButton* m_pCheckDataButton; ///< 临时“检查数据”诊断按钮,只读展示用。
NM_PHASE_TYPE m_eDisplayPhase; ///< 当前预览的流量相,纯展示状态,不写回井对象。
QString m_sPreviewPressureGaugeCode; ///< 当前页面预览的压力记录,不持久化。
QString m_sPreviewFlowGaugeCode; ///< 当前页面预览的流量记录,不持久化。
QVector<nmPressureGaugeRecord> m_vecPressureGaugeRecords; ///< 压力记录页面缓存。
QVector<nmFlowGaugeRecord> m_vecFlowGaugeRecords; ///< 每次填充流量下拉框时缓存的记录列表,供 currentFlowRecord() 安全返回内部指针。
};

@ -127,7 +127,71 @@ QString formatGaugeRecordLabel(const QString& sGaugeName,
return sGaugeCode.isEmpty() ? sGaugeName : sGaugeCode;
}
// 统一向压力/流量记录下拉框追加一项:身份无效的记录禁用不可选,空/损坏记录仍可选但追加提示后缀。
QString gaugeMetadataText(const QString& sText)
{
return sText.trimmed().isEmpty()
? nmWellPressureFlowPage::tr("(none)") : sText;
}
QString gaugeNameText(const QString& sGaugeName)
{
return sGaugeName.trimmed().isEmpty()
? nmWellPressureFlowPage::tr("(unnamed)") : sGaugeName;
}
QString gaugeRecordToolTip(const QString& sGaugeName,
const QString& sGaugeCode,
const QString& sGaugeTime)
{
QStringList listLines;
listLines << nmWellPressureFlowPage::tr("Curve name: %1")
.arg(gaugeNameText(sGaugeName));
listLines << nmWellPressureFlowPage::tr("Gauge Code: %1")
.arg(gaugeMetadataText(sGaugeCode));
listLines << nmWellPressureFlowPage::tr("Measurement time: %1")
.arg(gaugeMetadataText(sGaugeTime));
return listLines.join(QLatin1String("\n"));
}
void disableGaugeComboItem(QComboBox* pCombo, int nItemIndex)
{
QStandardItemModel* pModel =
qobject_cast<QStandardItemModel*>(pCombo->model());
if (pModel == nullptr)
{
return;
}
QStandardItem* pItem = pModel->item(nItemIndex);
if (pItem != nullptr)
{
pItem->setFlags(pItem->flags() & ~Qt::ItemIsEnabled);
}
}
void updatePreviewComboToolTip(QComboBox* pCombo)
{
if (pCombo == nullptr || pCombo->currentIndex() < 0 ||
pCombo->itemData(pCombo->currentIndex()).toString().isEmpty())
{
if (pCombo != nullptr)
{
pCombo->setToolTip(QString());
}
return;
}
QString sToolTip = pCombo->itemData(
pCombo->currentIndex(), Qt::ToolTipRole).toString();
if (!sToolTip.isEmpty())
{
sToolTip += QLatin1Char('\n');
}
sToolTip += nmWellPressureFlowPage::tr(
"Preview only; calculation settings are unchanged.");
pCombo->setToolTip(sToolTip);
}
// 统一向压力/流量记录下拉框追加一项;异常记录保留状态提示但不可选。
void appendGaugeComboItem(QComboBox* pCombo,
const QString& sGaugeName,
const QString& sGaugeCode,
@ -151,18 +215,13 @@ void appendGaugeComboItem(QComboBox* pCombo,
}
pCombo->addItem(sLabel, sGaugeCode);
if (eStatus == NM_GaugeRecord_InvalidIdentity)
const int nItemIndex = pCombo->count() - 1;
pCombo->setItemData(nItemIndex,
gaugeRecordToolTip(sGaugeName, sGaugeCode, sGaugeTime),
Qt::ToolTipRole);
if (eStatus != NM_GaugeRecord_Usable)
{
QStandardItemModel* pModel =
qobject_cast<QStandardItemModel*>(pCombo->model());
if (pModel != nullptr)
{
QStandardItem* pItem = pModel->item(pCombo->count() - 1);
if (pItem != nullptr)
{
pItem->setFlags(pItem->flags() & ~Qt::ItemIsEnabled);
}
}
disableGaugeComboItem(pCombo, nItemIndex);
}
}
@ -686,6 +745,10 @@ void nmWellPressureFlowPage::setWell(nmDataWellBase* pWell)
}
m_pWell = pWell;
m_sPreviewPressureGaugeCode = pWell == nullptr
? QString() : pWell->getSelectedPressureGaugeCode();
m_sPreviewFlowGaugeCode = pWell == nullptr
? QString() : pWell->getSelectedFlowGaugeCode();
resetDataViews();
}
@ -697,17 +760,34 @@ void nmWellPressureFlowPage::refreshData()
return;
}
// 第一步:先刷新记录下拉框,确保当前选中 Code、显示相与后续取点保持一致。
// 第一步:恢复页面自己的预览记录,不修改井对象保存的计算记录选择。
populatePressureGaugeCombo();
populateFlowGaugeCombo();
populateDisplayPhaseCombo(currentFlowRecord());
// 第二步:井数据只复制到页面基准副本,后续显示换算不会回写井对象;
// 流量点按当前展示相读取,切换展示相不影响井别、m_nIndexF 或求解器输入。
QVector<QPointF> vecRawPressurePoints =
m_pWell->getPressurePoints();
QVector<QPointF> vecRawFlowPoints =
m_pWell->getFlowPoints(m_eDisplayPhase);
// 第二步:直接从预览记录复制数据,后续记录、相别和单位切换都不回写井对象。
const nmPressureGaugeRecord* pPressureRecord = currentPressureRecord();
const nmFlowGaugeRecord* pFlowRecord = currentFlowRecord();
QVector<QPointF> vecRawPressurePoints = pPressureRecord == nullptr
? QVector<QPointF>() : pPressureRecord->vecPressurePoints;
QVector<QPointF> vecRawFlowPoints;
if (pFlowRecord != nullptr)
{
switch (m_eDisplayPhase)
{
case PHASE_Oil:
vecRawFlowPoints = pFlowRecord->vecOilPoints;
break;
case PHASE_Gas:
vecRawFlowPoints = pFlowRecord->vecGasPoints;
break;
case PHASE_Water:
vecRawFlowPoints = pFlowRecord->vecWaterPoints;
break;
default:
break;
}
}
// 第三步:单位服务可能晚于页面构造完成,再刷新一次可用单位组。
initializeUnitSupport();
@ -750,6 +830,8 @@ void nmWellPressureFlowPage::refreshData()
void nmWellPressureFlowPage::clearData()
{
m_pWell = nullptr;
m_sPreviewPressureGaugeCode.clear();
m_sPreviewFlowGaugeCode.clear();
resetDataViews();
}
@ -841,6 +923,47 @@ void nmWellPressureFlowPage::slotFlowChartPointClicked(double dTimePoint)
findFlowSegmentByTableTime(dTableTimePoint));
}
void nmWellPressureFlowPage::slotPressureGaugePreviewChanged(int nIndex)
{
if (m_pWell == nullptr || nIndex < 0)
{
return;
}
const QString sGaugeCode =
m_pPressureGaugeCombo->itemData(nIndex).toString();
if (sGaugeCode.isEmpty() ||
sGaugeCode == m_sPreviewPressureGaugeCode)
{
updatePreviewComboToolTip(m_pPressureGaugeCombo);
return;
}
m_sPreviewPressureGaugeCode = sGaugeCode;
refreshData();
}
void nmWellPressureFlowPage::slotFlowGaugePreviewChanged(int nIndex)
{
if (m_pWell == nullptr || nIndex < 0)
{
return;
}
const QString sGaugeCode =
m_pFlowGaugeCombo->itemData(nIndex).toString();
if (sGaugeCode.isEmpty() || sGaugeCode == m_sPreviewFlowGaugeCode)
{
updatePreviewComboToolTip(m_pFlowGaugeCombo);
return;
}
m_sPreviewFlowGaugeCode = sGaugeCode;
m_eDisplayPhase = defaultDisplayPhase(currentFlowRecord());
m_nSelectedFlowSegment = -1;
refreshData();
}
void nmWellPressureFlowPage::slotDisplayPhaseChanged(int nIndex)
{
if (m_pWell == nullptr || nIndex < 0)
@ -1025,16 +1148,14 @@ void nmWellPressureFlowPage::createRecordSelectionBar()
m_pPressureGaugeCombo = new QComboBox(m_pRecordSelectionBar);
m_pPressureGaugeCombo->setEnabled(false);
m_pPressureGaugeCombo->setMinimumWidth(160);
m_pPressureGaugeCombo->setToolTip(
tr("This page only displays the selected record."));
m_pPressureGaugeCombo->setMaxVisibleItems(16);
QLabel* pFlowLabel = new QLabel(
tr("Flow Record"), m_pRecordSelectionBar);
m_pFlowGaugeCombo = new QComboBox(m_pRecordSelectionBar);
m_pFlowGaugeCombo->setEnabled(false);
m_pFlowGaugeCombo->setMinimumWidth(160);
m_pFlowGaugeCombo->setToolTip(
tr("This page only displays the selected record."));
m_pFlowGaugeCombo->setMaxVisibleItems(16);
// 显示相是纯展示状态,整体容器随记录是否为多相含数据而隐藏/显示。
m_pDisplayPhaseContainer = new QWidget(m_pRecordSelectionBar);
@ -1063,6 +1184,14 @@ void nmWellPressureFlowPage::createRecordSelectionBar()
pBarLayout->addStretch(1);
pBarLayout->addWidget(m_pCheckDataButton);
connect(m_pPressureGaugeCombo,
SIGNAL(currentIndexChanged(int)),
this,
SLOT(slotPressureGaugePreviewChanged(int)));
connect(m_pFlowGaugeCombo,
SIGNAL(currentIndexChanged(int)),
this,
SLOT(slotFlowGaugePreviewChanged(int)));
connect(m_pDisplayPhaseCombo,
SIGNAL(currentIndexChanged(int)),
this,
@ -1090,25 +1219,48 @@ void nmWellPressureFlowPage::populatePressureGaugeCombo()
return;
}
QVector<nmPressureGaugeRecord> vecRecords =
m_pWell->getPressureRecords();
m_pPressureGaugeCombo->setEnabled(false);
m_pPressureGaugeCombo->addItem(tr("None"), QString());
m_vecPressureGaugeRecords = m_pWell->getPressureRecords();
const QString sSelectedCode = m_pWell->getSelectedPressureGaugeCode();
int nCurrentIndex = 0;
for (int nIndex = 0; nIndex < vecRecords.size(); ++nIndex)
int nPreviewIndex = -1;
int nCalculationIndex = -1;
int nFirstUsableIndex = -1;
const QString sCalculationCode =
m_pWell->getSelectedPressureGaugeCode();
for (int nIndex = 0; nIndex < m_vecPressureGaugeRecords.size(); ++nIndex)
{
const nmPressureGaugeRecord& oRecord = vecRecords[nIndex];
const nmPressureGaugeRecord& oRecord =
m_vecPressureGaugeRecords[nIndex];
appendGaugeComboItem(m_pPressureGaugeCombo,
oRecord.sGaugeName, oRecord.sGaugeCode,
oRecord.sGaugeTime, oRecord.eStatus);
if (oRecord.sGaugeCode == sSelectedCode)
const int nItemIndex = m_pPressureGaugeCombo->count() - 1;
if (oRecord.eStatus != NM_GaugeRecord_Usable)
{
nCurrentIndex = nIndex + 1;
continue;
}
if (nFirstUsableIndex < 0)
{
nFirstUsableIndex = nItemIndex;
}
if (oRecord.sGaugeCode == m_sPreviewPressureGaugeCode)
{
nPreviewIndex = nItemIndex;
}
if (oRecord.sGaugeCode == sCalculationCode)
{
nCalculationIndex = nItemIndex;
}
}
const int nCurrentIndex = nPreviewIndex >= 0
? nPreviewIndex : (nCalculationIndex >= 0
? nCalculationIndex : (nFirstUsableIndex >= 0
? nFirstUsableIndex : -1));
m_pPressureGaugeCombo->setCurrentIndex(nCurrentIndex);
m_pPressureGaugeCombo->setEnabled(nFirstUsableIndex >= 0);
m_sPreviewPressureGaugeCode = nCurrentIndex >= 0
? m_pPressureGaugeCombo->itemData(nCurrentIndex).toString()
: QString();
updatePreviewComboToolTip(m_pPressureGaugeCombo);
m_pPressureGaugeCombo->blockSignals(bSignalsWereBlocked);
}
@ -1132,23 +1284,45 @@ void nmWellPressureFlowPage::populateFlowGaugeCombo()
// 缓存整份记录列表供 currentFlowRecord() 安全返回内部指针,记录内容切换记录时不变。
m_vecFlowGaugeRecords = m_pWell->getFlowRecords();
m_pFlowGaugeCombo->setEnabled(false);
m_pFlowGaugeCombo->addItem(tr("None"), QString());
const QString sSelectedCode = m_pWell->getSelectedFlowGaugeCode();
int nCurrentIndex = 0;
int nPreviewIndex = -1;
int nCalculationIndex = -1;
int nFirstUsableIndex = -1;
const QString sCalculationCode = m_pWell->getSelectedFlowGaugeCode();
for (int nIndex = 0; nIndex < m_vecFlowGaugeRecords.size(); ++nIndex)
{
const nmFlowGaugeRecord& oRecord = m_vecFlowGaugeRecords[nIndex];
appendGaugeComboItem(m_pFlowGaugeCombo,
oRecord.sGaugeName, oRecord.sGaugeCode,
oRecord.sGaugeTime, oRecord.eStatus);
if (oRecord.sGaugeCode == sSelectedCode)
const int nItemIndex = m_pFlowGaugeCombo->count() - 1;
if (oRecord.eStatus != NM_GaugeRecord_Usable)
{
continue;
}
if (nFirstUsableIndex < 0)
{
nFirstUsableIndex = nItemIndex;
}
if (oRecord.sGaugeCode == m_sPreviewFlowGaugeCode)
{
nPreviewIndex = nItemIndex;
}
if (oRecord.sGaugeCode == sCalculationCode)
{
nCurrentIndex = nIndex + 1;
nCalculationIndex = nItemIndex;
}
}
const int nCurrentIndex = nPreviewIndex >= 0
? nPreviewIndex : (nCalculationIndex >= 0
? nCalculationIndex : (nFirstUsableIndex >= 0
? nFirstUsableIndex : -1));
m_pFlowGaugeCombo->setCurrentIndex(nCurrentIndex);
m_pFlowGaugeCombo->setEnabled(nFirstUsableIndex >= 0);
m_sPreviewFlowGaugeCode = nCurrentIndex >= 0
? m_pFlowGaugeCombo->itemData(nCurrentIndex).toString()
: QString();
updatePreviewComboToolTip(m_pFlowGaugeCombo);
m_pFlowGaugeCombo->blockSignals(bSignalsWereBlocked);
}
@ -1273,17 +1447,25 @@ NM_PHASE_TYPE nmWellPressureFlowPage::defaultDisplayPhase(
return PHASE_UNKNOWN;
}
const nmFlowGaugeRecord* nmWellPressureFlowPage::currentFlowRecord() const
const nmPressureGaugeRecord* nmWellPressureFlowPage::currentPressureRecord() const
{
if (m_pWell == nullptr)
for (int nIndex = 0; nIndex < m_vecPressureGaugeRecords.size(); ++nIndex)
{
return nullptr;
if (m_vecPressureGaugeRecords[nIndex].sGaugeCode ==
m_sPreviewPressureGaugeCode)
{
return &m_vecPressureGaugeRecords[nIndex];
}
}
return nullptr;
}
const QString sSelectedCode = m_pWell->getSelectedFlowGaugeCode();
const nmFlowGaugeRecord* nmWellPressureFlowPage::currentFlowRecord() const
{
for (int nIndex = 0; nIndex < m_vecFlowGaugeRecords.size(); ++nIndex)
{
if (m_vecFlowGaugeRecords[nIndex].sGaugeCode == sSelectedCode)
if (m_vecFlowGaugeRecords[nIndex].sGaugeCode ==
m_sPreviewFlowGaugeCode)
{
return &m_vecFlowGaugeRecords[nIndex];
}
@ -1686,6 +1868,11 @@ void nmWellPressureFlowPage::resetDataViews()
m_vecRawFlowPoints.clear();
m_vecTableFlowPoints.clear();
m_nSelectedFlowSegment = -1;
if (m_pWell == nullptr)
{
m_sPreviewPressureGaugeCode.clear();
m_sPreviewFlowGaugeCode.clear();
}
// 井绑定切换或清空时先清空并禁用三个记录/相下拉框,等待 refreshData() 重新填充。
if (m_pPressureGaugeCombo != nullptr)
@ -1693,6 +1880,7 @@ void nmWellPressureFlowPage::resetDataViews()
bool bSignalsWereBlocked = m_pPressureGaugeCombo->blockSignals(true);
m_pPressureGaugeCombo->clear();
m_pPressureGaugeCombo->setEnabled(false);
m_pPressureGaugeCombo->setToolTip(QString());
m_pPressureGaugeCombo->blockSignals(bSignalsWereBlocked);
}
if (m_pFlowGaugeCombo != nullptr)
@ -1700,8 +1888,10 @@ void nmWellPressureFlowPage::resetDataViews()
bool bSignalsWereBlocked = m_pFlowGaugeCombo->blockSignals(true);
m_pFlowGaugeCombo->clear();
m_pFlowGaugeCombo->setEnabled(false);
m_pFlowGaugeCombo->setToolTip(QString());
m_pFlowGaugeCombo->blockSignals(bSignalsWereBlocked);
}
m_vecPressureGaugeRecords.clear();
m_vecFlowGaugeRecords.clear();
if (m_pDisplayPhaseCombo != nullptr)
{

@ -7,6 +7,7 @@
#include <QCheckBox>
#include <QDesktopWidget>
#include <QHBoxLayout>
#include <QStringList>
#include <QStyle>
#include <QWidget>
@ -125,6 +126,46 @@ QString gaugeRecordLabel(const QString& sGaugeName,
return sLabel;
}
QString gaugeRecordToolTip(const QString& sGaugeName,
const QString& sGaugeCode, const QString& sGaugeTime)
{
const QString sName = sGaugeName.trimmed().isEmpty()
? nmWxIncludeOtherWells::tr("(unnamed)") : sGaugeName;
const QString sCode = sGaugeCode.trimmed().isEmpty()
? nmWxIncludeOtherWells::tr("None") : sGaugeCode;
const QString sTime = sGaugeTime.trimmed().isEmpty()
? nmWxIncludeOtherWells::tr("None") : sGaugeTime;
QStringList listLines;
listLines << nmWxIncludeOtherWells::tr("Curve name: %1").arg(sName);
listLines << nmWxIncludeOtherWells::tr("Gauge Code: %1").arg(sCode);
listLines << nmWxIncludeOtherWells::tr("Measurement time: %1").arg(sTime);
return listLines.join(QLatin1String("\n"));
}
void appendGaugeRecordItem(QComboBox* pComboBox,
const QString& sGaugeName, const QString& sGaugeCode,
const QString& sGaugeTime)
{
pComboBox->addItem(gaugeRecordLabel(
sGaugeName, sGaugeCode, sGaugeTime), sGaugeCode);
pComboBox->setItemData(pComboBox->count() - 1,
gaugeRecordToolTip(sGaugeName, sGaugeCode, sGaugeTime),
Qt::ToolTipRole);
}
void updateGaugeComboToolTip(QComboBox* pComboBox)
{
if(pComboBox == nullptr || pComboBox->currentIndex() < 0) {
return;
}
QString sToolTip = pComboBox->itemData(
pComboBox->currentIndex(), Qt::ToolTipRole).toString();
if(sToolTip.isEmpty()) {
sToolTip = pComboBox->currentText();
}
pComboBox->setToolTip(sToolTip);
}
// 流动段索引是一基索引;统计段数时必须先排除框架可能写入的公共占位行。
int flowRecordSegmentCount(const nmFlowGaugeRecord& oRecord)
{
@ -588,6 +629,7 @@ void nmWxIncludeOtherWells::populateRateCombo(
const bool bSignalsWereBlocked = pComboBox->blockSignals(true);
pComboBox->clear();
pComboBox->addItem(tr("None"), QString());
pComboBox->setItemData(0, tr("None"), Qt::ToolTipRole);
// 选择控件只展示当前相真正可用的记录;异常记录仍可在“检查数据”中查看。
for(int nIndex = 0; nIndex < data.m_vecFlowRecords.size(); ++nIndex) {
@ -595,9 +637,8 @@ void nmWxIncludeOtherWells::populateRateCombo(
if(!isSelectableFlowPhase(oRecord, ePhase)) {
continue;
}
pComboBox->addItem(gaugeRecordLabel(
oRecord.sGaugeName, oRecord.sGaugeCode, oRecord.sGaugeTime),
oRecord.sGaugeCode);
appendGaugeRecordItem(pComboBox,
oRecord.sGaugeName, oRecord.sGaugeCode, oRecord.sGaugeTime);
}
int nCurrentIndex = 0;
@ -608,7 +649,7 @@ void nmWxIncludeOtherWells::populateRateCombo(
}
}
pComboBox->setCurrentIndex(nCurrentIndex);
pComboBox->setToolTip(pComboBox->currentText());
updateGaugeComboToolTip(pComboBox);
pComboBox->blockSignals(bSignalsWereBlocked);
}
@ -621,20 +662,20 @@ void nmWxIncludeOtherWells::populatePressureCombo(
const bool bSignalsWereBlocked = pComboBox->blockSignals(true);
pComboBox->clear();
pComboBox->addItem(tr("None"), QString());
pComboBox->setItemData(0, tr("None"), Qt::ToolTipRole);
for(int nIndex = 0; nIndex < data.m_vecPressureRecords.size(); ++nIndex) {
const nmPressureGaugeRecord& oRecord = data.m_vecPressureRecords[nIndex];
if(!isSelectablePressureRecord(oRecord)) {
continue;
}
pComboBox->addItem(gaugeRecordLabel(
oRecord.sGaugeName, oRecord.sGaugeCode, oRecord.sGaugeTime),
oRecord.sGaugeCode);
appendGaugeRecordItem(pComboBox,
oRecord.sGaugeName, oRecord.sGaugeCode, oRecord.sGaugeTime);
}
const int nCurrentIndex = pComboBox->findData(
data.m_sPressureGaugeCode);
pComboBox->setCurrentIndex(nCurrentIndex < 0 ? 0 : nCurrentIndex);
pComboBox->setToolTip(pComboBox->currentText());
updateGaugeComboToolTip(pComboBox);
pComboBox->blockSignals(bSignalsWereBlocked);
}
@ -779,7 +820,7 @@ void nmWxIncludeOtherWells::onPressureSourceChanged(int nIndex)
}
m_vecWellData[nRow].m_sPressureGaugeCode =
pComboBox->itemData(nIndex).toString();
pComboBox->setToolTip(pComboBox->currentText());
updateGaugeComboToolTip(pComboBox);
}
void nmWxIncludeOtherWells::onFlowSegmentChanged(int nIndex)

Loading…
Cancel
Save