HM-SPMS/product/src/gui/plugin/AlarmShieldWidget/CShieldTableDelegate.h

39 lines
1006 B
C
Raw Normal View History

#ifndef CSHIELDTABLEDELEGATE_H
#define CSHIELDTABLEDELEGATE_H
#include <QStyledItemDelegate>
#include "CShieldinfo.h"
class CShieldTableModel;
class CShieldTableDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
CShieldTableDelegate(CShieldTableModel *model, QObject *parent = 0);
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
bool editorEvent(QEvent *event, QAbstractItemModel *model,
const QStyleOptionViewItem &option, const QModelIndex &index) Q_DECL_OVERRIDE;
QColor buttonBackground();
void setButtonBackground(const QColor &color);
QColor buttonColor();
void setButtonColor(const QColor &color);
private:
void shield(ST_Shield_Info &info);
void unshield(ST_Shield_Info &info);
void delShield(ST_Shield_Info &info);
private:
CShieldTableModel * m_pModel;
QColor m_buttonBack;
QColor m_buttonColor;
};
#endif // CSHIELDTABLEDELEGATE_H