annotate 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
rev   line source
266
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2 #ifndef CERTIFICATELISTITEM_H
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 #define CERTIFICATELISTITEM_H
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4 /**
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 * @file certificateitemdelegate.h
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6 * @brief Item delegate drawing custom certificate items in list views.
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 *
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 */
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 #include <QStyledItemDelegate>
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 class CertificateItemDelegate : public QStyledItemDelegate
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 {
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 Q_OBJECT
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 public:
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 CertificateItemDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent){}
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 /**
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 * @brief Renders the delegate using the given painter and options.
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 *
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22 * @param painter The painter to draw the item.
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 * @param option The style options.
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
24 * @param index The model index of the item to draw.
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 */
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 void paint(QPainter *painter, const QStyleOptionViewItem &option,
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 const QModelIndex &index) const;
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 private:
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 /**
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 * @brief Draw the item using the given parameters.
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 *
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 * @param painter The painter to draw the item.
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 * @param option The style options.
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 * @param index The model index of the item to draw.
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37 * @param icon The icon to display.
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 * @param font The font used to draw text.
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 */
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 void drawItem(QPainter *painter, const QStyleOptionViewItem &option,
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
41 const QModelIndex &index, QIcon *icon, QFont *font) const;
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 };
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 #endif

http://wald.intevation.org/projects/trustbridge/