Mercurial > trustbridge
annotate ui/certificateitemdelegate.h @ 718:e7a070e64b80
(Issue26) Make updates tip and install button depend on changes
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 02 Jul 2014 16:27:46 +0200 |
parents | ab622e094786 |
children |
rev | line source |
---|---|
404 | 1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=2) | |
5 * and comes with ABSOLUTELY NO WARRANTY! | |
6 * See LICENSE.txt for details. | |
7 */ | |
581
ab622e094786
Changed defined name for certificate item delegate.
Raimund Renkert <rrenkert@intevation.de>
parents:
445
diff
changeset
|
8 #ifndef CERTIFICATELISTDELEGATE_H |
ab622e094786
Changed defined name for certificate item delegate.
Raimund Renkert <rrenkert@intevation.de>
parents:
445
diff
changeset
|
9 #define CERTIFICATELISTDELEGATE_H |
266
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 * @file certificateitemdelegate.h |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 * @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
|
13 * |
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 |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 #include <QStyledItemDelegate> |
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 class CertificateItemDelegate : public QStyledItemDelegate |
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 Q_OBJECT |
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 public: |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 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
|
24 |
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 * @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
|
27 * |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 * @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
|
29 * @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
|
30 * @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
|
31 */ |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 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
|
33 const QModelIndex &index) const; |
433
2e5499fae159
Set sizeHint for certificate item delegates.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
34 QSize sizeHint(const QStyleOptionViewItem &option, |
2e5499fae159
Set sizeHint for certificate item delegates.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
35 const QModelIndex &index) const; |
266
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 |
375
9e38a4bcd44e
Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
272
diff
changeset
|
37 /** @brief different roles for this tiem */ |
9e38a4bcd44e
Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
272
diff
changeset
|
38 enum ItemRole { |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
433
diff
changeset
|
39 DataRole = Qt::UserRole, /* The certificate details for the window */ |
375
9e38a4bcd44e
Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
272
diff
changeset
|
40 StatusRole, /* Certificate status */ |
9e38a4bcd44e
Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
272
diff
changeset
|
41 }; |
9e38a4bcd44e
Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
272
diff
changeset
|
42 |
266
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 private: |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 /** |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 * @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
|
47 * |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 * @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
|
49 * @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
|
50 * @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
|
51 * @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
|
52 * @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
|
53 */ |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 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
|
55 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
|
56 }; |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 #endif |