支持弹出对话框,选择井曲线。目前只支持选择(曲线、固井、气测、多臂井径),其他只读不支持修改。

This commit is contained in:
jiayulong 2026-05-11 17:33:34 +08:00
parent bd010069a1
commit f20abdb040
6 changed files with 429 additions and 12 deletions

View File

@ -3012,7 +3012,12 @@ void PropertyWidget::initCurveProperty(FormInfo *formInfo, QStringList strListOt
listPointStyle.append("和平标志");
//
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@"+m_strSlfName, QVariant::String);
QtVariantProperty* pItem = _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@"+m_strSlfName, VariantManager::filePathTypeId());
//m_pVariantManager->setAttribute(pItem, "filepath", m_strLineName + "@"+m_strSlfName);
//曲线
m_pVariantManager->setAttribute(pItem, "filter", "slf.Line@@"+ m_strSlfName+"@@"+m_strWellName+"@@curveObject");
//_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@"+m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("通常", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("通常", "显示单位", formInfo->m_strUnit, QVariant::String);
//
@ -3691,7 +3696,13 @@ void PropertyWidget::initLayerItemProperty(TransparentDraggableLayer* tdLayer, d
void PropertyWidget:: initGujingProperty(FormInfo *formInfo)
{
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
//
QtVariantProperty* pItem = _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@"+m_strSlfName, VariantManager::filePathTypeId());
//m_pVariantManager->setAttribute(pItem, "filepath", m_strLineName + "@"+m_strSlfName);
//固井
m_pVariantManager->setAttribute(pItem, "filter", "slf.Line@@"+ m_strSlfName+"@@"+m_strWellName+"@@gujingObject");
//_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("对象", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("对象", "垂向绘制", formInfo->m_bVerticaDrawing, QVariant::Bool);
@ -3720,7 +3731,13 @@ void PropertyWidget::initGujingItemProperty(TransparentDraggableGujing* tdGujing
m_strTrackName = formInfo->m_strTrackName;
m_strLineName = formInfo->m_strLineName;
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
//
QtVariantProperty* pItem = _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@"+m_strSlfName, VariantManager::filePathTypeId());
//m_pVariantManager->setAttribute(pItem, "filepath", m_strLineName + "@"+m_strSlfName);
//固井
m_pVariantManager->setAttribute(pItem, "filter", "slf.Line@@"+ m_strSlfName+"@@"+m_strWellName+"@@gujingObject");
//_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("对象", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("名称", "垂向绘制", formInfo->m_bVerticaDrawing, QVariant::Bool);
_CreateVariantPropertyItem("名称", "旋转角度(°)", formInfo->m_nRotationAngle, QVariant::Int);
@ -4159,7 +4176,13 @@ void PropertyWidget::initGeoLithItemProperty(TransparentDraggableGeoLith* tdGeoL
//气测/FMT/射孔/文本
void PropertyWidget::initJiegutextProperty(FormInfo *formInfo)
{
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
//
QtVariantProperty* pItem = _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@"+m_strSlfName, VariantManager::filePathTypeId());
//m_pVariantManager->setAttribute(pItem, "filepath", m_strLineName + "@"+m_strSlfName);
//气测/FMT/射孔/文本
m_pVariantManager->setAttribute(pItem, "filter", "slf.Line@@"+ m_strSlfName+"@@"+m_strWellName+"@@JiegutextObject");
//_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("对象", "字体", formInfo->m_curveNameFont, QVariant::Font);
_CreateVariantPropertyItem("对象", "颜色", formInfo->m_lineColor, QVariant::Color);
@ -4196,7 +4219,13 @@ void PropertyWidget::initJiegutextItemProperty(TransparentDraggableJiegutext* td
m_strTrackName = formInfo->m_strTrackName;
m_strLineName = formInfo->m_strLineName;
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
//
QtVariantProperty* pItem = _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@"+m_strSlfName, VariantManager::filePathTypeId());
//m_pVariantManager->setAttribute(pItem, "filepath", m_strLineName + "@"+m_strSlfName);
//气测/FMT/射孔/文本
m_pVariantManager->setAttribute(pItem, "filter", "slf.Line@@"+ m_strSlfName+"@@"+m_strWellName+"@@JiegutextObject");
//_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
_CreateVariantPropertyItem("对象", "字体", formInfo->m_curveNameFont, QVariant::Font);
_CreateVariantPropertyItem("对象", "颜色", formInfo->m_lineColor, QVariant::Color);
@ -5828,11 +5857,19 @@ void PropertyWidget::changedDenvProperty(QString strProperty, QVariant varVal)
emit CallManage::getInstance()->sig_changeDenvProperty(m_formInfo->m_strUuid, m_formInfo->m_strSlfName, m_formInfo->m_strWellName, m_formInfo->m_strTrackName, m_formInfo->m_strLineName);
}
}
//多臂井径
void PropertyWidget::initMCalsProperty(FormInfo *formInfo)
{
_CreateVariantPropertyItem("曲线图名", "显示名称", formInfo->m_strAliasName, QVariant::String);
_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
//
QtVariantProperty* pItem = _CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@"+m_strSlfName, VariantManager::filePathTypeId());
//m_pVariantManager->setAttribute(pItem, "filepath", m_strLineName + "@"+m_strSlfName);
//多臂井径
m_pVariantManager->setAttribute(pItem, "filter", "slf.Line@@"+ m_strSlfName+"@@"+m_strWellName+"@@MCalsObject");
//_CreateVariantPropertyItem("通常", "选择井曲线", m_strLineName + "@" + m_strSlfName, QVariant::String);
//
_CreateVariantPropertyItem("网格图", "最小井径", formInfo->m_MinVal, QVariant::Double);

View File

@ -26,6 +26,9 @@
#include <QToolButton>
#include <QFileDialog>
#include <QFocusEvent>
#include "selectlinedialog.h"
extern QString g_SelectLine_filePath;
FileEdit::FileEdit(QWidget *parent)
: QWidget(parent)
@ -35,6 +38,7 @@ FileEdit::FileEdit(QWidget *parent)
layout->setSpacing(0);
theLineEdit = new QLineEdit(this);
theLineEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred));
theLineEdit->setReadOnly(true);//只读
QToolButton *button = new QToolButton(this);
button->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred));
button->setText(QLatin1String("..."));
@ -51,13 +55,43 @@ FileEdit::FileEdit(QWidget *parent)
void FileEdit::buttonClicked()
{
QString filePath = QFileDialog::getOpenFileName(this, tr("选择文件"), strFilePath, theFilter);
if (filePath.isNull())
return;
if(theFilter.contains("slf.Line"))
{
QStringList listTmp = theFilter.split("@@");
if(listTmp.size()>3)
{
QString strSlfName = listTmp[1];
QString strWellName = listTmp[2];
QString strType = listTmp[3];
// 创建对话框
SelectLineDialog *dlg = new SelectLineDialog(nullptr);
dlg->setInfo(strSlfName, strWellName, strType);
//
dlg->setAttribute(Qt::WA_DeleteOnClose);//关闭时,自动删除窗口对象
int result = dlg->exec();//模态对话框
if (result == QDialog::Accepted) {
// 处理用户点击了确定按钮的逻辑
QString filePath = g_SelectLine_filePath + "@" + strSlfName;
theLineEdit->setText(filePath);
emit filePathChanged(filePath);
}
else if (result == QDialog::Rejected) {
// 处理用户点击了取消按钮的逻辑
}
else {
// 处理其他情况的逻辑
}
}
}
else{
QString filePath = QFileDialog::getOpenFileName(this, tr("选择文件"), strFilePath, theFilter);
if (filePath.isNull())
return;
QFileInfo finfo(filePath);
theLineEdit->setText(finfo.baseName());
emit filePathChanged(filePath);
QFileInfo finfo(filePath);
theLineEdit->setText(finfo.baseName());
emit filePathChanged(filePath);
}
}
void FileEdit::focusInEvent(QFocusEvent *e)

View File

@ -83,6 +83,7 @@ SOURCES += \
qmytreewidget.cpp \
qtcommonclass.cpp \
qtprojectwidgets.cpp \
selectlinedialog.cpp \
selectwelldialog.cpp \
totalTitleBar.cpp \
transparentdraggableGuan.cpp \
@ -150,6 +151,7 @@ HEADERS += \
qmytreewidget.h \
qtcommonclass.h \
qtprojectwidgets.h \
selectlinedialog.h \
selectwelldialog.h \
totalTitleBar.h \
transparentdraggableGuan.h \
@ -177,6 +179,7 @@ FORMS += \
mainwindowsplitter.ui \
newheaddialog.ui \
qtprojectwidgets.ui \
selectlinedialog.ui \
selectwelldialog.ui
INCLUDEPATH += ../include/ \

View File

@ -0,0 +1,243 @@
#include "selectlinedialog.h"
#include "ui_selectlinedialog.h"
#include <QFile>
#include <QDebug>
#include <QTextStream>
#include "LogIO.h"
QString g_SelectLine_filePath = "";
SelectLineDialog::SelectLineDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::SelectLineDialog)
{
ui->setupUi(this);
loadStyle(":/qrc/qss/flatgray.css");
g_SelectLine_filePath = "";
//
connect(ui->ok, SIGNAL(clicked()), this, SLOT(slotOkClicked()));
connect(ui->cancel, SIGNAL(clicked()), this, SLOT(slotCancelClicked()));
}
SelectLineDialog::~SelectLineDialog()
{
delete ui;
}
void SelectLineDialog::loadStyle(const QString &qssFile)
{
//加载样式表
QString qss;
QFile file(qssFile);
if (file.open(QFile::ReadOnly)) {
//用QTextStream读取样式文件不用区分文件编码 带bom也行
QStringList list;
QTextStream in(&file);
//in.setCodec("utf-8");
while (!in.atEnd()) {
QString line;
in >> line;
list << line;
}
file.close();
qss = list.join("\n");
QString paletteColor = qss.mid(20, 7);
this->setPalette(QPalette(paletteColor));
//用时主要在下面这句
this->setStyleSheet(qss);
}
}
void SelectLineDialog::setInfo(QString fileFull, QString strWellName, QString strType)
{
CLogIO * logio=new CLogIO();
if(!logio->Open(fileFull.toStdString().c_str(),CSlfIO::modeRead))
{
delete logio;
QString aa=fileFull+"文件打开失败,请检查!";
qDebug() << aa;
//AppendConsole(pai::log::PAI_ERROR,aa);
return;
}
else
{
Slf_FILE_MESSAGE mssage;
logio->GetFileMessage(mssage);
if(strWellName != QString(QString::fromLocal8Bit(mssage.WellName)))
{
delete logio;
return;
}
char* curvename=new char[65];
curvename[64]='\0';
char* aliasname=new char[65];
aliasname[64]='\0';
//
int nSlfCount = logio->GetObjectCount();
for(int i = 0; i< nSlfCount; i++)
{
logio->GetObjectName(i,curvename,NULL,aliasname);
if(!logio->IsObject(i)) {
logio->DiscardObject(i);
continue;
};
if(logio->GetObjectStatus(i)!=OBJECT_NORMAL)
{
continue;
}
short curvetype=logio->GetObjectType(i);
//
short Attribute=0,SubAttribute=0;
logio->GetObjectAttribute(i,&Attribute,&SubAttribute);
QString strCurveName = QString::fromLocal8Bit(curvename);
if(curvetype>CARD_OBJECT || 0 == curvetype)
{
qDebug() << "strCurveName: " << strCurveName;
//表格数据
if (strCurveName == "GUJING1_RESULT" || strCurveName == "GUJING2_RESULT" || strCurveName == "GUJING3_RESULT")
{
//固井
if(strType=="gujingObject")
{
//下拉列表
ui->comboBox->addItem(strCurveName);
}
}
else
{
//气测/FMT/射孔/文本(去掉固井曲线)
if(strType=="JiegutextObject")
{
//下拉列表
ui->comboBox->addItem(strCurveName);
}
}
}
else if(CURVE_OBJECT == curvetype)
{
//曲线
if(strType!="curveObject")
{
continue;
}
//判断曲线有效性
Slf_CURVE acurveinfo;
logio->GetCurveInfo(i,&acurveinfo);
if(acurveinfo.DepLevel!=0&&(acurveinfo.EndDepth-acurveinfo.StartDepth>0))
{
if(acurveinfo.MaxValue==acurveinfo.MinValue||acurveinfo.MaxValue==-99999||acurveinfo.MaxValue==-9999||acurveinfo.MinValue==999999||acurveinfo.MinValue==999999||acurveinfo.MinValue==99999||acurveinfo.MinValue==99999||acurveinfo.MinValue==-9999){
int curveindex=logio->OpenSlfTable(i,-1);
if(curveindex>-1)
{
MyDataTypeEnum vVdl;
DWORD count=(acurveinfo.EndDepth-acurveinfo.StartDepth)/acurveinfo.DepLevel+1.5;
DWORD len=count*acurveinfo.CodeLen;
acurveinfo.MinValue=99999999;
acurveinfo.MaxValue=-99999999;
if(acurveinfo.CodeLen==8) acurveinfo.MinValue=99999999;
vVdl.vchar=new char[len];
len=logio->ReadCurve(curveindex, acurveinfo.StartDepth,count,(void *)vVdl.vchar);
if(!len) {
QString cs;
char buf[1000];
sprintf(buf,"%s %f-%f",acurveinfo.Name,acurveinfo.StartDepth,acurveinfo.EndDepth);
cs=buf;
int flag = QMessageBox::warning(NULL,"提示",QString(cs+"\n曲线信息异常!删除该曲线可能需要较长时间,建议复制正常曲线等信息到新文件,然后删除此文件。是否此时直接将该曲线删除?"),QMessageBox::Yes,QMessageBox::No);
if(flag==QMessageBox::Yes) logio->DiscardObject(i);
delete vVdl.vchar;
continue;
}
for(int kk=0;kk<count;kk=kk+10)
{
float buf[200];
buf[0]=0;
float temp=logio->GetData(acurveinfo.RepCode,&vVdl.vchar[kk*acurveinfo.CodeLen],buf);
#ifdef WIN32
if(_isnan(temp)||!_finite(temp)) continue;
#else
if(__isnan(temp)||!__finite(temp)) continue;
#endif // WIN32
if(acurveinfo.MaxValue<temp) if(temp!=-9999.0&&temp!=-999.25&&temp!=-99999.0)acurveinfo.MaxValue=temp;
if(acurveinfo.MinValue>temp) if(temp!=-9999.0&&temp!=-999.25&&temp!=-99999.0)acurveinfo.MinValue=temp;
}
logio->SetCurveInfo(curveindex,&acurveinfo);
delete vVdl.vchar;
}
}
}
else if(acurveinfo.DepLevel==0||acurveinfo.StartDepth<-100000||acurveinfo.StartDepth>100000)
{
QString cs;
char buf[1000];
sprintf(buf,"%s %f-%f",acurveinfo.Name,acurveinfo.StartDepth,acurveinfo.EndDepth);
cs=buf;
int flag = QMessageBox::warning(NULL,"提示",QString(cs+"\n曲线信息异常!删除该曲线可能需要较长时间,建议复制正常曲线等信息到新文件,然后删除此文件。是否此时直接将该曲线删除?"),QMessageBox::Yes,QMessageBox::No);
if(flag==QMessageBox::Yes) logio->DiscardObject(i);
continue;
}
//下拉列表
ui->comboBox->addItem(strCurveName);
}
else if(CARD_OBJECT == curvetype)
{
//参数卡-》树图
}
else if(WAVE_OBJECT == curvetype)
{
//波列
//多臂井径
if(strType=="MCalsObject")
{
//下拉列表
ui->comboBox->addItem(strCurveName);
}
}
else if(TDT_OBJECT == curvetype)
{
//TDT-》树图
}
}
delete []curvename;
delete []aliasname;
delete logio;
//delete []pEntry;
}
}
//
void SelectLineDialog::slotOkClicked()
{
// g_SelectWellIndex = ui->comboBox->currentIndex();
QString strLine = ui->comboBox->currentText();
if(strLine=="")
{
return;
}
g_SelectLine_filePath = strLine;
//关闭
accept(); // 让 QDialog::exec() 返回 QDialog::Accepted
//QDialog::close();
}
//
void SelectLineDialog::slotCancelClicked()
{
reject(); // 让 QDialog::exec() 返回 QDialog::Rejected
//QDialog::close();
}

View File

@ -0,0 +1,30 @@
#ifndef SELECTLINEDIALOG_H
#define SELECTLINEDIALOG_H
#include <QDialog>
namespace Ui {
class SelectLineDialog;
}
class SelectLineDialog : public QDialog
{
Q_OBJECT
public:
explicit SelectLineDialog(QWidget *parent = nullptr);
~SelectLineDialog();
private:
Ui::SelectLineDialog *ui;
public:
void loadStyle(const QString &qssFile);
void setInfo(QString strSlf, QString strWellName, QString strType);
public slots:
void slotOkClicked();
void slotCancelClicked();
};
#endif // SELECTLINEDIALOG_H

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SelectLineDialog</class>
<widget class="QDialog" name="SelectLineDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>选择井曲线</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>选择井曲线:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="ok">
<property name="text">
<string>选择</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancel">
<property name="text">
<string>取消</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>