107 lines
2.6 KiB
C++
107 lines
2.6 KiB
C++
/**
|
|
* @file ModulePortInfoGraphicsItem.h
|
|
* @brief 端口进度信息item
|
|
* @date 2011-10-31
|
|
*/
|
|
#ifndef PAI_FRAME_WORKFLOWWIDGET_MODULEPORTINFOGRAPHICSITEM_H
|
|
#define PAI_FRAME_WORKFLOWWIDGET_MODULEPORTINFOGRAPHICSITEM_H
|
|
|
|
#include <QGraphicsItem>
|
|
|
|
namespace pai
|
|
{
|
|
namespace graphics2d
|
|
{
|
|
class ModuleGraphicsItem;
|
|
}
|
|
}
|
|
|
|
namespace pai
|
|
{
|
|
namespace graphics2d
|
|
{
|
|
/**
|
|
* @class ModulePortInfoGraphicsItem
|
|
* @brief 模块端口进度item
|
|
*/
|
|
class ModulePortInfoGraphicsItem : public QGraphicsItem
|
|
{
|
|
public:
|
|
/**
|
|
* @brief item类型
|
|
*/
|
|
enum
|
|
{
|
|
Type = UserType + 1002 ///< 当前Item类型
|
|
};
|
|
|
|
/**
|
|
* @brief 构造函数
|
|
* @param[in] pModuleItem 模块对象指针
|
|
* @param[in] portDirection 端口方向
|
|
* @param[in] portIndex 端口索引
|
|
* @param[in] pParent 父亲
|
|
*/
|
|
ModulePortInfoGraphicsItem(pai::graphics2d::ModuleGraphicsItem *pModuleItem,
|
|
PortDirection portDirection,
|
|
int portIndex,
|
|
QGraphicsItem *pParent = NULL);
|
|
|
|
/**
|
|
* @brief 析构函数
|
|
*/
|
|
virtual ~ModulePortInfoGraphicsItem();
|
|
|
|
/**
|
|
* @brief 获取item类型
|
|
* @return item类型
|
|
*/
|
|
virtual int type() const;
|
|
|
|
/**
|
|
* @brief 实现该虚函数,返回模块连线及文字的包围矩形
|
|
* @return item外围矩形
|
|
*/
|
|
virtual QRectF boundingRect() const;
|
|
|
|
/**
|
|
* @brief 获取端口方向
|
|
* @return 端口方向
|
|
*/
|
|
PortDirection GetPortDirection() const;
|
|
|
|
/**
|
|
* @brief 获取端口索引
|
|
* @return 端口索引
|
|
*/
|
|
int GetPortIndex() const;
|
|
|
|
/**
|
|
* @brief 设置进度条信息
|
|
* @param[in] trace 进度
|
|
* @param[in] time 速度
|
|
*/
|
|
void SetPrgsInfo(int trace, int speed);
|
|
|
|
protected:
|
|
/**
|
|
* @brief 实现该虚函数,绘制端口信息
|
|
* @param[in] pPainter 画笔
|
|
* @param[in] pOption 模块风格参数
|
|
* @param[in] pWidget 画布
|
|
*/
|
|
virtual void paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget *pWidget = NULL);
|
|
|
|
private:
|
|
pai::graphics2d::ModuleGraphicsItem *m_pModuleItem; ///< 模块
|
|
pai::graphics2d::PortDirection m_PortDirection; ///< 端口方向
|
|
int m_PortIndex; ///< 指示了起始模块的第几个输出端口
|
|
int m_TraceFinished; ///< 进度
|
|
int m_speed; ///< 速度
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif ///< PAI_FRAME_WORKFLOWWIDGET_MODULEPORTINFOGRAPHICSITEM_H
|