Mercurial > trustbridge
annotate ui/certificateitemdelegate.h @ 439:c88090a15ae4
Fix cinstprocesstest for new arguments. Handle errno on write errors
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 22 Apr 2014 13:27:23 +0000 |
parents | 2e5499fae159 |
children | b3721ded6f5b |
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 */ | |
266
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 #ifndef CERTIFICATELISTITEM_H |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 #define CERTIFICATELISTITEM_H |
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 { |
9e38a4bcd44e
Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
272
diff
changeset
|
39 DetailsRole = Qt::UserRole, /* The certificate details for the window */ |
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 B64LineRole /* The I:/R: <cert> line */ |
9e38a4bcd44e
Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
272
diff
changeset
|
42 }; |
9e38a4bcd44e
Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
272
diff
changeset
|
43 |
266
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 private: |
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 /** |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 * @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
|
48 * |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 * @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
|
50 * @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
|
51 * @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
|
52 * @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
|
53 * @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
|
54 */ |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
55 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
|
56 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
|
57 }; |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 #endif |