annotate ui/certificateitemdelegate.h @ 424:81cf25402cb0

Merge
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 17 Apr 2014 08:55:16 +0000
parents 17e1c8f37d72
children 2e5499fae159
rev   line source
404
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 375
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 375
diff changeset
2 * Software engineering by Intevation GmbH
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 375
diff changeset
3 *
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 375
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 375
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 375
diff changeset
6 * See LICENSE.txt for details.
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 375
diff changeset
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;
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34
375
9e38a4bcd44e Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 272
diff changeset
35 /** @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
36 enum ItemRole {
9e38a4bcd44e Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 272
diff changeset
37 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
38 StatusRole, /* Certificate status */
9e38a4bcd44e Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 272
diff changeset
39 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
40 };
9e38a4bcd44e Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 272
diff changeset
41
266
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
42 private:
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43
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 * @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
46 *
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 * @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
48 * @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
49 * @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
50 * @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
51 * @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
52 */
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 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
54 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
55 };
dd6a09d2699f Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 #endif

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