logplus/Workflow/WFEngine/Component/WorkflowWidget/include/PaiJobErrorInfoItem.h
2026-01-16 17:18:41 +08:00

240 lines
5.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file PaiJobErrorInfoItem.h
* @brief 日志错误信息item
* @date 2013-04-20
*/
#ifndef PAI_FRAME_WORKFLOWWIDGET_PAIJOBERRORINFOITEM_H
#define PAI_FRAME_WORKFLOWWIDGET_PAIJOBERRORINFOITEM_H
#include <QGraphicsItem>
#include <QWidget>
#include <QRectF>
#include <QGraphicsProxyWidget>
#include <QScrollArea>
#include <QObject>
#include <QApplication>
#include <QScrollBar>
#include <QPushButton>
namespace pai
{
namespace gui
{
class PaiJobErrorInofWidget;
class PaiJobErrorInfoItem;
}
}
namespace pai
{
namespace gui
{
/**
* @class PaiArrowButton
* @brief 上下箭头按钮
*/
class PaiArrowButton : public QPushButton
{
Q_OBJECT
public:
/**
*@brief 构造函数
*@param[in] text 按钮内容
*@param[in] pParent 按钮父窗口指针
*/
PaiArrowButton(QString text, QWidget *pParent = NULL);
/**
* @brief 设置向上图标
* @param[in] icon 向上图标
*/
void SetUpIcon(const QString& icon);
/**
* @brief 设置向下图标
* @param[in] icon 向下图标
*/
void SetDownIcon(const QString& icon);
protected:
/**
* @brief 鼠标进入按钮事件
* param[in] pEvent 鼠标进入按钮时触发
*/
virtual void enterEvent(QEvent *pEvent);
/**
* @brief 鼠标离开按钮事件
* param[in] pEvent 鼠标离开按钮时触发
*/
virtual void leaveEvent(QEvent *pEvent);
private:
/**
*@brief 设置按钮的图标和大小
*@param[in] icon 图标
*/
void SetBtnIcon(const QString& icon);
private:
QString m_UpIcon; ///< 向上图标
QString m_DownIcon; ///< 向下图标
};
/**
* @class PaiJobErrorInfoItemAgentWgt
* @brief 代理widget
*/
class PaiJobErrorInfoItemAgentWgt : public QWidget
{
Q_OBJECT
public:
/**
*@brief 构造函数
*@param[in] pParent 父窗口
*@param[in] pItem 场景中错误信息项
*/
PaiJobErrorInfoItemAgentWgt(QWidget *pParent = NULL, PaiJobErrorInfoItem *pItem = NULL);
/**
*@brief 析构函数
*/
virtual ~PaiJobErrorInfoItemAgentWgt();
/**
*@brief 设置滚动区域
*@param[in] pScrollBar 滚动条
*/
void setScroBarValue(QScrollBar *pScrollBar);
public slots:
/**
*@brief 点击向上按钮执行的操作
*@param[in] show 显示或者隐藏
*/
void UpErrorBar(bool show);
/**
*@brief 点击向下按钮执行的操作
*@param[in] show 显示或者隐藏
*/
void DownErrorBar(bool show);
/**
* @biref 当所有infoBar被关闭时调用
*/
void HideItem();
private:
QScrollBar *m_pVerScrollBar; ///< 滚动条
PaiArrowButton *m_pBtnUp; ///< 向上箭头按钮
PaiArrowButton *m_pBtnDown; ///< 向下箭头按钮
PaiJobErrorInfoItem *m_pJobItem; ///< 场景中错误信息项
};
/**
* @class PaiJobErrorInfoItem
* @brief A1区场景中的错误信息item
*/
class PaiJobErrorInfoItem : public QGraphicsItem
{
public:
/**
*@brief item的类型
*/
enum
{
Type = UserType + 1459 ///< 当前item类型
};
/**
*@brief 构造函数
*@param[in] pParent 父窗口指针
*/
PaiJobErrorInfoItem(QGraphicsItem *pParent = NULL);
/**
*@brief 析构函数
*/
virtual ~PaiJobErrorInfoItem();
/**
*@brief 返回item类型
*@return item类型
*/
virtual int type() const;
/**
* @brief 实现该虚函数,返回模块图元的包围矩形
* @return item外围矩形
*/
virtual QRectF boundingRect() const;
/**
* @brief 更新位置
*/
void UpdatePosition();
/**
* @brief 增加一条错误信息
* @param[in] error 错误信息
*/
void AddErrorInfo(const QString& error);
/**
*@brief 设置错误对话框是否显示
*/
void ShowErrorInfoWgt();
/**
*@brief 点击向上错误按钮更新错误信息
*/
void UpButtonErrorInfo();
/**
*@brief 点击向下错误按钮更新错误信息
*/
void DownButtonErrorInfo();
/**
*@brief 检查是否可以使能错误信息
*/
bool EnableError();
private:
/**
* @brief 实现该虚函数绘制错误item
* @param[in] pPainter 画笔
* @param[in] pOption 模块风格参数
* @param[in] pWidget 画布
*/
virtual void paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget *pWidget = NULL);
/*
* @brief 获取被展开Item的索引
* @return 索引
*/
int GetExpandedIndex() const;
/*
* @brief 关闭展开项
* @param[in] errorList InfoBar链表
*/
void CloseExpanded(QList< struct ErrorBarPos > &errorList);
private:
qreal m_width; ///< item外边框的宽度
qreal m_height; ///< item外边框的高度
PaiJobErrorInofWidget *m_pJobErrorInofDlg; ///< 错误信息条的容器
QScrollArea *m_pscrollArea; ///< 滚动条
PaiJobErrorInfoItemAgentWgt *m_pErrorAgentWgt; ///< 代理widget
QStringList m_errors; ///< 错误信息List
int m_UpdatePos; ///< 更新的错误信息位置
};
}
}
#endif ///< PAI_FRAME_WORKFLOWWIDGET_PAIJOBERRORINFOITEM_H