logplus/ModuleConsole/src/PaiModuleToolBarView.cpp

89 lines
2.5 KiB
C++
Raw Normal View History

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>
#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);
styleToolBar->addAction(new PaiComAction());
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()));
}
CPaiModuleToolBarView::~CPaiModuleToolBarView()
{
// TODO Auto-generated destructor stub
}