Mercurial > trustbridge
annotate ui/certificateitemdelegate.h @ 384:638db75f0fdf
Ignore sigpipe if the child closed the channel or there is an error
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 15 Apr 2014 17:47:33 +0200 |
parents | 9e38a4bcd44e |
children | 17e1c8f37d72 |
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 |
375
9e38a4bcd44e
Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
272
diff
changeset
|
28 /** @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
|
29 enum ItemRole { |
9e38a4bcd44e
Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
272
diff
changeset
|
30 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
|
31 StatusRole, /* Certificate status */ |
9e38a4bcd44e
Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
272
diff
changeset
|
32 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
|
33 }; |
9e38a4bcd44e
Move certificateitem role into the certificateitemdelagate where it belongs.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
272
diff
changeset
|
34 |
266
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 private: |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 /** |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 * @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
|
39 * |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 * @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
|
41 * @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
|
42 * @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
|
43 * @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
|
44 * @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
|
45 */ |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 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
|
47 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
|
48 }; |
dd6a09d2699f
Added delegate for certificate list items to render a custom ui.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 #endif |