153 lines
4.3 KiB
C++
153 lines
4.3 KiB
C++
/*
|
|
* @file ParameterEditor.h
|
|
* @brief 参数编辑面板的界面实现
|
|
* @date: 2011-9-16
|
|
* @Author: dev
|
|
*/
|
|
|
|
#ifndef PAI_FRAME_WORKFLOWVIEW_PARAMETEREDITOR_H
|
|
#define PAI_FRAME_WORKFLOWVIEW_PARAMETEREDITOR_H
|
|
#include <QTextEdit>
|
|
#include <QTreeView>
|
|
#include "ModuleParameter.h"
|
|
#include "ModuleCheckResult.h"
|
|
#include "WorkflowSpecialTypes.h"
|
|
#include "ModuleInformation.h"
|
|
namespace pai
|
|
{
|
|
namespace graphics2d
|
|
{
|
|
|
|
class ParameterEditorModel;
|
|
class ParameterItemDelegate;
|
|
|
|
/**
|
|
* @class CParameterEditor
|
|
* @brief 参数编辑面板
|
|
*/
|
|
class CParameterEditor :public QTreeView
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
/**
|
|
* @brief 构造函数
|
|
* @param[in] pParent 父指针
|
|
*/
|
|
CParameterEditor(QWidget* pParent);
|
|
|
|
/**
|
|
* @brief 析构函数
|
|
*/
|
|
virtual ~CParameterEditor();
|
|
|
|
/**
|
|
* @brief 清空参数编辑面板的所有内容
|
|
*/
|
|
void Clear();
|
|
QTextEdit * GetEdit()
|
|
{
|
|
return m_pEdtParamCard;
|
|
}
|
|
void SetEdit(QTextEdit *pEdit)
|
|
{
|
|
m_pEdtParamCard=pEdit;
|
|
}
|
|
bool GetCurrentZone(float &sdep,float &edep);
|
|
void FinishInputData();
|
|
pai::workflow::CModuleInformation *GetModuleInfo();
|
|
|
|
public slots:
|
|
void slotZoneValueChanged(QString zonename);
|
|
|
|
/**
|
|
* @brief 用于恢复模块的信息
|
|
* @param[in] backModule 恢复的模块信息
|
|
*/
|
|
|
|
void slotChangeCurrentParam(QWidget *pWin,float depth,float minX);
|
|
|
|
void slotChangeExpand(QWidget *pWin,float depth,int zoneno);
|
|
void slotChangeMXParam(QWidget *pWin,float depth,float minX,float maxX,QString curvename,int zoneno,int changetype);
|
|
void slotAddDepth(QWidget *pWin,float depth);
|
|
void slotDeleteDepth(QWidget *pWin,float depth);
|
|
void slotExclieChanged(const QString& id);
|
|
void slotBackModule(pai::workflow::CModuleInformation *pBakcModule);
|
|
/**
|
|
* @brief 强制重新打开参数编辑器
|
|
* @param[in] pInfo 选中模块对应的 module information
|
|
*/
|
|
void slotForceOpen(pai::workflow::CModuleInformation* pInfo);
|
|
void slotgetCurrentIndex(const QModelIndex &index);
|
|
protected:
|
|
/**
|
|
* @brief 实现resize以便重新布局
|
|
* @param[in] pEvent 重置大小事件
|
|
*/
|
|
void resizeEvent ( QResizeEvent * pEvent );
|
|
|
|
/**
|
|
* @brief 画某行item的分支
|
|
* @param[in] painter 画笔指针
|
|
* @param[in] rect 画的区域
|
|
* @param[in] index item索引
|
|
*/
|
|
virtual void drawBranches ( QPainter * pPainter, const QRect & rect, const QModelIndex & index ) const;
|
|
|
|
/**
|
|
* @brief 重载该函数来定制插入行数据时的逻辑,这里用来永久地打开编辑器
|
|
* @param[in] parent 插入目标节点的索引
|
|
* @param[in] start 插入起始位置
|
|
* @param[in] end 插入结束位置
|
|
*/
|
|
virtual void rowsInserted ( const QModelIndex & parent, int start, int end );
|
|
|
|
private slots:
|
|
/**
|
|
* @brief 保证某项能够被看到
|
|
* @param[in] index
|
|
*/
|
|
void slotOnMakeIndexVisible(const QModelIndex &index);
|
|
|
|
/**
|
|
* @brief 打开模块参数编辑器
|
|
* @param[in] pInfo 模块参数信息
|
|
* @param[in] IsModuleReadOnly 模块是否来自只读场景
|
|
*/
|
|
void slotOpen(pai::workflow::CModuleInformation* pInfo, bool IsModuleReadOnly);
|
|
|
|
|
|
|
|
/**
|
|
* @brief 当某个索引指向的对象的属性变化时,界面对之作出的响应函数
|
|
* @param[in] dataIndex 发生属性变化的数据项对应的索引
|
|
* @param[in] strPropertyName 属性名
|
|
* @param[in] varPropertyValue 变化后的属性值
|
|
*/
|
|
void slotOnDataPropertyChanged(const QModelIndex& dataIndex,const QString& strPropertyName,const QVariant& varPropertyValue);
|
|
|
|
/**
|
|
* @brief 在参数面板上显示错误信息
|
|
* @param[in] pModuleInfo 模块对象句柄
|
|
* @param[in] errorInfo 该模块的错误信息集合
|
|
* @param[in] eventSource 验证线程事件源类型
|
|
*/
|
|
void slotShowErrors(pai::workflow::CModuleInformation * pModuleInfo,bool,pai::module::CModuleCheckResult errorInfo, ValidateEventSource eventSource);
|
|
|
|
private:
|
|
/**
|
|
* @brief 根据传入参数初始化参数编辑面板
|
|
* @param[in] pInfo 模块对象句柄
|
|
*/
|
|
void Init(pai::workflow::CModuleInformation* pInfo);
|
|
private:
|
|
pai::workflow::CModuleInformation *m_moduleInfo;
|
|
ParameterEditorModel *m_model;
|
|
ParameterItemDelegate *m_paramItemDelegate;
|
|
QTextEdit * m_pEdtParamCard;
|
|
int old_zoneno;
|
|
};
|
|
|
|
}
|
|
}
|
|
#endif
|