2026-01-16 17:18:41 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @file: PaiModuleToolBar.h
|
|
|
|
|
|
* @brief 包括模块树和模块树上方工具条的组合视图
|
|
|
|
|
|
* @date: 2011-9-20
|
|
|
|
|
|
* @author: sinopec
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
|
|
#include <QIcon>
|
|
|
|
|
|
#include <QBoxLayout>
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
#include <QtDebug>
|
2026-05-08 15:51:15 +08:00
|
|
|
|
#include <QMessageBox>
|
2026-01-16 17:18:41 +08:00
|
|
|
|
#include "PaiWidgetAction.h"
|
|
|
|
|
|
#include "PaiModuleToolBarView.h"
|
|
|
|
|
|
#include "PaiModuleTree.h"
|
|
|
|
|
|
#include "PaiToolBar.h"
|
|
|
|
|
|
#include "PaiSearchLineEdit.h"
|
|
|
|
|
|
#include "PaiComboBox.h"
|
|
|
|
|
|
using namespace pai;
|
|
|
|
|
|
using namespace pai::gui;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @class PaiComAction
|
|
|
|
|
|
* @brief 为PaiComboBox实现的 WidgetAction类
|
|
|
|
|
|
*/
|
|
|
|
|
|
class PaiComAction : public PaiWidgetAction
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 构造函数
|
|
|
|
|
|
* @param[in] pParent 父指针
|
|
|
|
|
|
*/
|
|
|
|
|
|
PaiComAction(QObject *parent=0);
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @brief 创建控件
|
|
|
|
|
|
*/
|
|
|
|
|
|
virtual QWidget *NewWidget(QWidget *parent);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
PaiComAction::PaiComAction(QObject *parent)
|
|
|
|
|
|
:PaiWidgetAction(parent)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QWidget *PaiComAction::NewWidget(QWidget *parent)
|
|
|
|
|
|
{
|
|
|
|
|
|
PaiComboBox* comBox = new PaiComboBox(parent);
|
|
|
|
|
|
comBox->addItem(/*tr*/("Alphabetical Order"));
|
|
|
|
|
|
comBox->setMinimumWidth(150);
|
|
|
|
|
|
return comBox;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
CPaiModuleToolBarView::CPaiModuleToolBarView(QWidget *parent):PaiToolBarView(parent)
|
|
|
|
|
|
{
|
|
|
|
|
|
QIcon icon = QApplication::style()->standardIcon(QStyle::SP_CommandLink);
|
|
|
|
|
|
//删除里面所有的toolBar,其实只有一个默认toolBar
|
|
|
|
|
|
QList<QToolBar*> pToolBar = this->GetToolBars();
|
|
|
|
|
|
for(int i=0; i<pToolBar.size(); i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
RemoveToolBar(pToolBar.at(i));
|
|
|
|
|
|
}
|
|
|
|
|
|
PaiToolBar* styleToolBar = new PaiToolBar("", NULL);
|
|
|
|
|
|
styleToolBar->setContentsMargins(1,0,30,0);//设置左右的空白
|
|
|
|
|
|
|
|
|
|
|
|
//添加查询控件
|
|
|
|
|
|
PaiSearchLineEdit* pSearchModuleLEdit = new PaiSearchLineEdit;
|
|
|
|
|
|
styleToolBar->addWidget(pSearchModuleLEdit);
|
2026-05-08 15:51:15 +08:00
|
|
|
|
m_pComWellSlfFile = new PaiComAction();
|
|
|
|
|
|
styleToolBar->addAction(m_pComWellSlfFile);
|
|
|
|
|
|
|
2026-01-16 17:18:41 +08:00
|
|
|
|
this->AddToolBar(styleToolBar, PaiToolBarView::SMALL_TOOLBAR);
|
|
|
|
|
|
|
|
|
|
|
|
// 因需等待搜索结果,再响应returnPressed信号把搜索的结果放入工作流视图,
|
|
|
|
|
|
// 所以需要将该值设置为50ms,原因请看函数体注释
|
|
|
|
|
|
pSearchModuleLEdit->SetEditStopDuration(50);
|
|
|
|
|
|
|
|
|
|
|
|
m_pModuleTree = new CPaiModuleTree(NULL);
|
|
|
|
|
|
m_pModuleTree->expandAll();
|
|
|
|
|
|
this->SetViewport(m_pModuleTree);
|
|
|
|
|
|
|
|
|
|
|
|
connect(pSearchModuleLEdit,SIGNAL(EditingStoped(const QString&)),m_pModuleTree,SLOT(Filter(const QString&)));
|
|
|
|
|
|
connect(pSearchModuleLEdit,SIGNAL(returnPressed()), m_pModuleTree, SLOT(RequireDeliverSelectedModules()));
|
2026-05-08 15:51:15 +08:00
|
|
|
|
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 "";
|
2026-01-16 17:18:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CPaiModuleToolBarView::~CPaiModuleToolBarView()
|
|
|
|
|
|
{
|
|
|
|
|
|
// TODO Auto-generated destructor stub
|
|
|
|
|
|
}
|
2026-05-08 15:51:15 +08:00
|
|
|
|
void CPaiModuleToolBarView::oncurrentIndexChanged(int index)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|