Mercurial > trustbridge
annotate ui/certificateitemdelegate.h @ 353:666abcfab229
Implemented setData in certificate table model.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 10 Apr 2014 15:56:59 +0200 |
parents | abac76b855b2 |
children | 9e38a4bcd44e |
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 #ifndef CERTIFICATELISTITEM_H |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 #define CERTIFICATELISTITEM_H |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 /** |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
4 * @file certificateitemdelegate.h |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 * @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
|
6 * |
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 #include <QStyledItemDelegate> |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 class CertificateItemDelegate : public QStyledItemDelegate |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 { |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 Q_OBJECT |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 public: |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 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
|
17 |
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 * @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
|
20 * |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 * @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
|
22 * @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
|
23 * @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
|
24 */ |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 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
|
26 const QModelIndex &index) const; |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 private: |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 |
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 * @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
|
32 * |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 * @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
|
34 * @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
|
35 * @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
|
36 * @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
|
37 * @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
|
38 */ |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 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
|
40 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
|
41 }; |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 #endif |