aheinecke@404: /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik aheinecke@404: * Software engineering by Intevation GmbH aheinecke@404: * aheinecke@404: * This file is Free Software under the GNU GPL (v>=2) aheinecke@404: * and comes with ABSOLUTELY NO WARRANTY! aheinecke@404: * See LICENSE.txt for details. aheinecke@404: */ rrenkert@266: #ifndef CERTIFICATELISTITEM_H rrenkert@266: #define CERTIFICATELISTITEM_H rrenkert@266: /** rrenkert@266: * @file certificateitemdelegate.h rrenkert@266: * @brief Item delegate drawing custom certificate items in list views. rrenkert@266: * rrenkert@266: */ rrenkert@266: rrenkert@266: #include rrenkert@266: rrenkert@266: class CertificateItemDelegate : public QStyledItemDelegate rrenkert@266: { rrenkert@266: Q_OBJECT rrenkert@266: rrenkert@266: public: rrenkert@266: CertificateItemDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent){} rrenkert@266: rrenkert@266: /** rrenkert@266: * @brief Renders the delegate using the given painter and options. rrenkert@266: * rrenkert@266: * @param painter The painter to draw the item. rrenkert@266: * @param option The style options. rrenkert@266: * @param index The model index of the item to draw. rrenkert@266: */ rrenkert@266: void paint(QPainter *painter, const QStyleOptionViewItem &option, rrenkert@266: const QModelIndex &index) const; rrenkert@433: QSize sizeHint(const QStyleOptionViewItem &option, rrenkert@433: const QModelIndex &index) const; rrenkert@266: andre@375: /** @brief different roles for this tiem */ andre@375: enum ItemRole { rrenkert@445: DataRole = Qt::UserRole, /* The certificate details for the window */ andre@375: StatusRole, /* Certificate status */ andre@375: }; andre@375: rrenkert@266: private: rrenkert@266: rrenkert@266: /** rrenkert@266: * @brief Draw the item using the given parameters. rrenkert@266: * rrenkert@266: * @param painter The painter to draw the item. rrenkert@266: * @param option The style options. rrenkert@266: * @param index The model index of the item to draw. rrenkert@266: * @param icon The icon to display. rrenkert@266: * @param font The font used to draw text. rrenkert@266: */ rrenkert@266: void drawItem(QPainter *painter, const QStyleOptionViewItem &option, rrenkert@266: const QModelIndex &index, QIcon *icon, QFont *font) const; rrenkert@266: }; rrenkert@266: #endif