Mercurial > trustbridge
diff ui/certificateitemdelegate.h @ 266:dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 02 Apr 2014 09:26:38 +0200 |
parents | |
children | abac76b855b2 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/certificateitemdelegate.h Wed Apr 02 09:26:38 2014 +0200 @@ -0,0 +1,43 @@ + +#ifndef CERTIFICATELISTITEM_H +#define CERTIFICATELISTITEM_H +/** + * @file certificateitemdelegate.h + * @brief Item delegate drawing custom certificate items in list views. + * + */ + +#include <QStyledItemDelegate> + +class CertificateItemDelegate : public QStyledItemDelegate +{ +Q_OBJECT + +public: + CertificateItemDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent){} + + /** + * @brief Renders the delegate using the given painter and options. + * + * @param painter The painter to draw the item. + * @param option The style options. + * @param index The model index of the item to draw. + */ + void paint(QPainter *painter, const QStyleOptionViewItem &option, + const QModelIndex &index) const; + +private: + + /** + * @brief Draw the item using the given parameters. + * + * @param painter The painter to draw the item. + * @param option The style options. + * @param index The model index of the item to draw. + * @param icon The icon to display. + * @param font The font used to draw text. + */ + void drawItem(QPainter *painter, const QStyleOptionViewItem &option, + const QModelIndex &index, QIcon *icon, QFont *font) const; +}; +#endif