1、完成 井参数设置的界面搭建;

feature/ribbon-menu-20240927
simonyan 5 hours ago
parent 3497a09f45
commit 751c6263b0

@ -1,27 +0,0 @@
#ifndef NMRCDIALOG_H
#define NMRCDIALOG_H
#include <QDialog>
#include <QObject>
#include "nmSubWxs_global.h"
class QTableWidget;
// 储层特性
class NM_SUB_WXS_EXPORT nmRCDialog : public QDialog
{
Q_OBJECT
public:
nmRCDialog();
private slots:
void on_save();
private:
void initUI();
private:
QTableWidget* m_pTableWidget;
};
#endif // NMRCDIALOG_H

@ -0,0 +1,29 @@
#ifndef NMWXRCDIALOG_H
#define NMWXRCDIALOG_H
#include <QDialog>
#include <QObject>
#include "nmSubWxs_global.h"
class QTableWidget;
// 鍌ㄥ眰鐗规€
class NM_SUB_WXS_EXPORT nmWxRCDialog : public QDialog
{
Q_OBJECT
public:
nmWxRCDialog();
private slots:
void on_save();
private:
void initUI();
QWidget* initOilReservoirUI();
QWidget* initWellsUI();
private:
QTableWidget* m_pTableWidget;
};
#endif // NMWXRCDIALOG_H

@ -0,0 +1,63 @@
#ifndef NMWXRCWELL_H
#define NMWXRCWELL_H
#include <QWidget>
class QListWidget;
class QLineEdit;
class QTableWidget;
class nmWxRCWell : public QWidget
{
Q_OBJECT
public:
explicit nmWxRCWell(QVector<QString> wellNames, QVector<double> wellsRadius, QWidget *parent = nullptr);
signals:
private slots:
// 选择井
void on_selectWell(int index);
// 修改表皮系数
void on_wellSkinChanged(QString);
private:
// 根据井的数量,先初始化默认值
void initDefaultValue();
// 初始化UI
void initUI();
QListWidget* initListWidget();
QWidget* initWellDetailWidget();
// 展示井的详情
void showWellDetail(int index);
private:
// 井的数量
QVector<QString> m_vWellNames;
// 井的半径
QVector<double> m_vWellsRadius;
// 井的表皮系数
QVector<double> m_vWellsSkin;
// 井储系数
QVector<double> m_vWellsReservoirFactor;
// 井的流量段比如井的流量段时2则有2个持续时间和2个流量
QVector<int> m_vWellsTimeNum;
// 井的流量持续时间组
QVector<QVector<double>> m_vWellTimes;
// 井的流量组
QVector<QVector<double>> m_vWellFlows;
// 井列表
QListWidget* m_pWellListWidget;
// 井半径
QLineEdit* m_pWellRadiusEdit;
// 井的表皮系数
QLineEdit* m_pWellSkinEdit ;
// 井储系数
QLineEdit* m_pWellReservoirFactorEdit;
// 井的流量段比如井的流量段时2则有2个持续时间和2个流量
QLineEdit* m_pWellTimeEdit;
// 设置流量段数据的table
QTableWidget* m_pTimeTableWidget;
};
#endif // NMWXRCWELL_H

@ -47,7 +47,7 @@
#include "nmObjPointWell.h"
#include "nmRCDialog.h"
#include "nmWxRCDialog.h"
#include <QVector>
@ -877,10 +877,10 @@ bool nmSubWndMain::onConfirmClosing()
void nmSubWndMain::reservoirCharacteristics()
{
// 显示储藏特性的弹窗,设置参数,并保持到文件
nmRCDialog* dlg = new nmRCDialog;
nmWxRCDialog* dlg = new nmWxRCDialog;
dlg->exec();
}
void nmSubWndMain::geoLayering()
{
}
}

@ -1,20 +1,22 @@
#include "nmRCDialog.h"
#include "nmWxRCDialog.h"
#include <QVBoxLayout>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QHeaderView>
#include <QPushButton>
#include <QDebug>
#include <QTabWidget>
#include "ZxBaseUtil.h"
#include "nmWxRCWell.h"
nmRCDialog::nmRCDialog()
nmWxRCDialog::nmWxRCDialog()
{
this->initUI();
this->resize(800, 360);
this->resize(800, 720);
}
void nmRCDialog::on_save()
void nmWxRCDialog::on_save()
{
// 检查第1列是否都写了值如何不全则不能提交
QStringList valueList;
@ -45,10 +47,33 @@ void nmRCDialog::on_save()
this->accept();
}
void nmRCDialog::initUI()
void nmWxRCDialog::initUI()
{
QVBoxLayout* mainLayout = new QVBoxLayout;
this->setLayout(mainLayout);
QTabWidget* tabWidget = new QTabWidget;
mainLayout->addWidget(tabWidget);
// 油藏属性设置
tabWidget->addTab(this->initOilReservoirUI(), tr("OilReservoir"));
tabWidget->addTab(this->initWellsUI(), tr("Wells"));
// 井属性设置
// 下方的操作按钮
// 底部按钮
QHBoxLayout* hLayout = new QHBoxLayout;
QPushButton* saveBT = new QPushButton("Save");
QPushButton* cancelBT = new QPushButton("Cancel");
connect(saveBT, SIGNAL(clicked()), this, SLOT(on_save()));
connect(cancelBT, SIGNAL(clicked()), this, SLOT(reject()));
hLayout->addStretch();
hLayout->addWidget(saveBT);
hLayout->addWidget(cancelBT);
mainLayout->addLayout(hLayout);
}
QWidget* nmWxRCDialog::initOilReservoirUI()
{
QVBoxLayout* mainLayout = new QVBoxLayout;
m_pTableWidget = new QTableWidget;
// 设置为3列
// 第一列是 名称,也是垂直的表头
@ -100,16 +125,17 @@ void nmRCDialog::initUI()
m_pTableWidget->setItem(row, column, item);
}
}
mainLayout->addWidget(m_pTableWidget);
// 下方的操作按钮
// 底部按钮
QHBoxLayout* hLayout = new QHBoxLayout;
QPushButton* saveBT = new QPushButton("Save");
QPushButton* cancelBT = new QPushButton("Cancel");
connect(saveBT, SIGNAL(clicked()), this, SLOT(on_save()));
connect(cancelBT, SIGNAL(clicked()), this, SLOT(reject()));
hLayout->addStretch();
hLayout->addWidget(saveBT);
hLayout->addWidget(cancelBT);
mainLayout->addLayout(hLayout);
return m_pTableWidget;
}
QWidget* nmWxRCDialog::initWellsUI()
{
QVector<QString> wellNames;
wellNames.append("well1");
wellNames.append("well2");
QVector<double> wellRadius;
wellRadius.append(0.05);
wellRadius.append(0.03);
nmWxRCWell* widget = new nmWxRCWell(wellNames, wellRadius, NULL);
return widget;
}

@ -0,0 +1,107 @@
#include "nmWxRCWell.h"
#include <QListWidget>
#include <QHBoxLayout>
#include <QFormLayout>
#include <QLineEdit>
#include <QLabel>
#include <QTableWidget>
#include <QDebug>
nmWxRCWell::nmWxRCWell(QVector<QString> wellNames, QVector<double> wellsRadius, QWidget *parent) :
m_vWellNames(wellNames), m_vWellsRadius(wellsRadius), QWidget(parent)
{
this->initDefaultValue();
this->initUI();
}
void nmWxRCWell::on_selectWell(int index)
{
qDebug() << index;
this->showWellDetail(index);
}
void nmWxRCWell::on_wellSkinChanged(QString v)
{
int index = m_pWellListWidget->currentRow();
m_vWellsSkin[index] = v.toDouble();
}
void nmWxRCWell::initDefaultValue()
{
// 根据井的数量初始化默认值
for (int i = 0; i < m_vWellNames.size(); i++) {
// 井的表皮系数
m_vWellsSkin.append(0);
// 井储系数
m_vWellsReservoirFactor.append(0.1);
// 流量段
m_vWellsTimeNum.append(2);
}
}
void nmWxRCWell::initUI()
{
QHBoxLayout* layout = new QHBoxLayout;
this->setLayout(layout);
QListWidget* wellListWidget = this->initListWidget();
// 坐标的列表页
layout->addWidget(wellListWidget);
QWidget* detailWidget = this->initWellDetailWidget();
// 右边的详情页
layout->addWidget(detailWidget);
// 设置宽度比例
layout->setStretchFactor(wellListWidget, 1);
layout->setStretchFactor(detailWidget, 2);
// 设置默认是第1口井
wellListWidget->setCurrentRow(0);
}
QListWidget* nmWxRCWell::initListWidget()
{
m_pWellListWidget = new QListWidget;
m_pWellListWidget->addItems(m_vWellNames.toList());
connect(m_pWellListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(on_selectWell(int)));
return m_pWellListWidget;
}
QWidget* nmWxRCWell::initWellDetailWidget()
{
QWidget* detailWidget = new QWidget;
QVBoxLayout* mainLayout = new QVBoxLayout;
detailWidget->setLayout(mainLayout);
// 1、井的通用设置
QFormLayout* layout = new QFormLayout;
// 显示井的半径
m_pWellRadiusEdit = new QLineEdit;
m_pWellRadiusEdit->setEnabled(false);
layout->addRow(new QLabel(tr("radius")), m_pWellRadiusEdit);
// 井的表皮系数
m_pWellSkinEdit = new QLineEdit;
connect(m_pWellSkinEdit, SIGNAL(textChanged(QString)), this, SLOT(on_wellSkinChanged(QString)));
layout->addRow(new QLabel(tr("skin")), m_pWellSkinEdit);
// 井储系数
m_pWellReservoirFactorEdit = new QLineEdit;
layout->addRow(new QLabel(tr("RF")), m_pWellReservoirFactorEdit);
// 井的流量段比如井的流量段时2则有2个持续时间和2个流量
m_pWellTimeEdit = new QLineEdit;
layout->addRow(new QLabel(tr("TimeNum")), m_pWellTimeEdit);
mainLayout->addLayout(layout);
// 勾选是 统一设置,还是 单独设置
// 2、井的流量设置
m_pTimeTableWidget = new QTableWidget;
mainLayout->addWidget(m_pTimeTableWidget);
return detailWidget;
}
void nmWxRCWell::showWellDetail(int index)
{
qDebug() << "show well detail " << index << m_vWellsRadius.size();
m_pWellRadiusEdit->setText(QString::number(m_vWellsRadius[index]));
// 井的表皮系数
m_pWellSkinEdit->setText(QString::number(m_vWellsSkin[index]));
// 井储系数
m_pWellReservoirFactorEdit->setText(QString::number(m_vWellsReservoirFactor[index]));
// 井的流量段比如井的流量段时2则有2个持续时间和2个流量
m_pWellTimeEdit->setText(QString::number(m_vWellsTimeNum[index]));
}
Loading…
Cancel
Save