算法添加下拉菜单选择井次

This commit is contained in:
zhaolei 2026-05-08 15:51:15 +08:00
parent 54fd59e965
commit f66adb2c72
10 changed files with 72 additions and 10 deletions

View File

@ -114,6 +114,7 @@ public:
PaiPushButton *m_pbtnRun;
QString m_CurrentSLFFileName;
QToolBar *m_toolBar_plugin = NULL;
QMap<QString,QString> m_mapAllSlfFile;// 保存全部Slf文件
};
/**

View File

@ -9,8 +9,9 @@
#define PAI_FRAME_WORKFLOWVIEW_PAIMODULETOOLBARVIEW_H
#include <QWidget>
#include <QMap>
#include "PaiToolBarView.h"
class PaiComAction;
namespace pai
{
class CPaiModuleTree;
@ -29,7 +30,13 @@ namespace pai
virtual ~CPaiModuleToolBarView();
CPaiModuleTree* GetModuleTree(){return m_pModuleTree;}
void setAllSlfFile(QMap<QString,QString> mapAllSlfFile, QString CurrentSLFFileName);
QString getCurrentSLFFileName();
public slots:
void oncurrentIndexChanged(int index);
private:
QMap<QString,QString> m_mapAllSlfFile;// 保存全部Slf文件
PaiComAction * m_pComWellSlfFile;
CPaiModuleTree* m_pModuleTree;
};
}

View File

@ -393,6 +393,7 @@ CParameterEditor * CModuleParamers::CreatParamControlWidget()
///处理模块
QSplitter * m_pSplitter=new QSplitter(Qt::Orientation::Vertical);
m_ModuleToolBarView = new CPaiModuleToolBarView(NULL);
m_ModuleToolBarView->setAllSlfFile(m_mapAllSlfFile, m_CurrentSLFFileName);
m_pSplitter->addWidget(m_ModuleToolBarView);
m_PWorkflowWidget = new WorkflowWidget(pModuleConsole->m_pWorkflowDataModel);
WorkflowSceneManager *pWorkflowScene = new WorkflowSceneManager(0,0,800,750,m_PWorkflowWidget);
@ -943,6 +944,7 @@ void CModuleParamers::OnSetParameterOK(int stpar)
QString CModuleParamers::GetCurrentSLFFileName()
{
m_CurrentSLFFileName = m_ModuleToolBarView->getCurrentSLFFileName();
return m_CurrentSLFFileName;
// CModuleConsole *pModuleConsole=m_pModuleConsole;
// if(!pModuleConsole) return "";

View File

@ -11,6 +11,7 @@
#include <QBoxLayout>
#include <QAction>
#include <QtDebug>
#include <QMessageBox>
#include "PaiWidgetAction.h"
#include "PaiModuleToolBarView.h"
#include "PaiModuleTree.h"
@ -67,7 +68,9 @@ CPaiModuleToolBarView::CPaiModuleToolBarView(QWidget *parent):PaiToolBarView(par
//添加查询控件
PaiSearchLineEdit* pSearchModuleLEdit = new PaiSearchLineEdit;
styleToolBar->addWidget(pSearchModuleLEdit);
styleToolBar->addAction(new PaiComAction());
m_pComWellSlfFile = new PaiComAction();
styleToolBar->addAction(m_pComWellSlfFile);
this->AddToolBar(styleToolBar, PaiToolBarView::SMALL_TOOLBAR);
// 因需等待搜索结果再响应returnPressed信号把搜索的结果放入工作流视图
@ -80,9 +83,44 @@ CPaiModuleToolBarView::CPaiModuleToolBarView(QWidget *parent):PaiToolBarView(par
connect(pSearchModuleLEdit,SIGNAL(EditingStoped(const QString&)),m_pModuleTree,SLOT(Filter(const QString&)));
connect(pSearchModuleLEdit,SIGNAL(returnPressed()), m_pModuleTree, SLOT(RequireDeliverSelectedModules()));
connect(m_pComWellSlfFile->GetDefaultWidget(),SIGNAL(currentIndexChanged(int)),this,SLOT(oncurrentIndexChanged(int)));
}
void CPaiModuleToolBarView::setAllSlfFile(QMap<QString,QString> mapAllSlfFile,QString CurrentSLFFileName)
{
m_mapAllSlfFile = mapAllSlfFile;
PaiComboBox* pComboBox = dynamic_cast<PaiComboBox *>(m_pComWellSlfFile->GetDefaultWidget());
if (pComboBox)
{
pComboBox->clear();
QList<QString> listShowSlfName = mapAllSlfFile.keys();
int iSel = 0;
for (int i = 0; i<listShowSlfName.size(); i++)
{
pComboBox->addItem(listShowSlfName.at(i));
QString strSLFFileName = mapAllSlfFile[listShowSlfName.at(i)];
if (CurrentSLFFileName == strSLFFileName)
iSel = i;
}
if (iSel>0)
pComboBox->setCurrentIndex(iSel);
}
}
QString CPaiModuleToolBarView::getCurrentSLFFileName()
{
PaiComboBox* pComboBox = dynamic_cast<PaiComboBox *>(m_pComWellSlfFile->GetDefaultWidget());
if (pComboBox && m_mapAllSlfFile.size()>0)
{
return m_mapAllSlfFile[pComboBox->currentText()];
}
return "";
}
CPaiModuleToolBarView::~CPaiModuleToolBarView()
{
// TODO Auto-generated destructor stub
}
void CPaiModuleToolBarView::oncurrentIndexChanged(int index)
{
}

View File

@ -125,9 +125,21 @@ QModelIndex ParameterEditorModel::parent(const QModelIndex & index) const
if (NULL != pChildItem)
{
ParameterProperty *pParentItem = dynamic_cast<ParameterProperty*> (pChildItem->GetParent());
char szTemp[128];
sprintf(szTemp,"%16X",this );
QString qstrTemp = szTemp;
char szTemp2[128];
sprintf(szTemp2,"%16X",pParentItem );
QString qstrTemp2 = szTemp2;
if (qstrTemp.contains("DDDDDDD") || qstrTemp2.contains("DDDDDDD"))// 有时候指针错误崩溃
{
// QMessageBox::information(NULL,"aa","aa");
return QModelIndex();
}
if (pParentItem)
{
if (pParentItem->IsRoot())
{
return QModelIndex();

View File

@ -1337,8 +1337,11 @@ void WorkflowSceneManager::slotAddModule(const QString& moduleName)
CModuleParamers *pModuleParamers = pModuleConsole->g_mModuleParamers;
PELibraryModule* amodule=amodule2;
// amodule->SetSlfFileName("D:/jiayl0909/logPlus/build/Logdata/JPH-307.slf");
amodule->SetSlfFileName(pModuleParamers->m_CurrentSLFFileName);
// amodule->SetSlfFileName("Logdata/JPH-307.slf");
QFileInfo fileinfo;
fileinfo = QFileInfo(pModuleParamers->GetCurrentSLFFileName());
amodule3->GetMetaData()->SetName(amodule3->GetMetaData()->GetName() + "(" + fileinfo.completeBaseName().toStdString() + ")" );
amodule->SetSlfFileName(pModuleParamers->GetCurrentSLFFileName());
amodule->InitModule(m_pParameterEditor);

View File

@ -29,6 +29,7 @@ void MainWindowSplitter::setSplitterWidget(QtProjectWidgets *pWidgets)
pModuleConsole->m_pWorkflowDataModel = new CWellLogWorkflowDataModel();
pDialog->m_CurrentSLFFileName = pWidgets->m_strSlfName;
pDialog->m_toolBar_plugin = m_PluginToolBar;
pDialog->m_mapAllSlfFile = pWidgets->m_mapAllSlfFile;
pDialog->CreatParamControlWidget();
//QString subStr = strSlfName;

View File

@ -19,7 +19,6 @@ class MainWindowSplitter : public QMainWindow
public:
explicit MainWindowSplitter(QWidget *parent = nullptr);
~MainWindowSplitter();
void setSplitterWidget(QtProjectWidgets *pWidgets);
void setModuleOpenOrClose();
@ -35,11 +34,7 @@ private:
public slots:
public:
QtProjectWidgets *m_leftWidgets = NULL; //左侧工程区
};
#endif // MainWindowSplitter_H

View File

@ -245,6 +245,7 @@ void QtProjectWidgets::s_loadTreeWidget(QString fileFull)
parent->addChild(itemIndex);//添加一级子节点
//数据导入
m_qmapWellFiles.clear();
m_mapAllSlfFile.clear();
loadIndexSysTree(itemIndex, fileFull, g_prjname);
//数据分析
@ -493,6 +494,7 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q
fileinfo = QFileInfo(fileFull);
wellname = fileinfo.completeBaseName();//井次
}
m_mapAllSlfFile[wellname] = fileFull;
// if(wellname != parentWellname)
// {
// //井次名称不一致

View File

@ -128,6 +128,7 @@ public:
QString m_strCutSlfName;
QMap<QString,QList<QString>> m_mapShowObject;// 显示Slf文件里对象名
QMap<QString,QList<QString>> m_mapCopyObject;// 复制Slf文件里对象名
QMap<QString,QString> m_mapAllSlfFile;// 保存全部Slf文件
CDataManagger *magr;//
int m_ReFlag;