logplus/Workflow/WFEngine/Component/WorkflowWidget/include/PaiJobErrorInfoItem.h

240 lines
5.3 KiB
C
Raw Normal View History

2026-01-16 17:18:41 +08:00
/**
* @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