Mercurial > trustbridge
annotate ui/certificatetabledelegate.h @ 938:15f7b3ebf21b
(issue89) Add help packaging for Linux installer
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 22 Aug 2014 19:16:31 +0200 |
parents | 17e1c8f37d72 |
children | 78798d3af8f0 |
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 */ | |
347
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 #ifndef CERTIFICATETABLEDELEGATE_H |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 #define CERTIFICATETABLEDELEGATE_H |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 /** |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 * @file certificatetabledelegate.h |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 * @brief Item delegate drawing custom certificate items in table views. |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 * |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 */ |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 #include <QStyledItemDelegate> |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 class CertificateTableDelegate : public QStyledItemDelegate |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 { |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 Q_OBJECT |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 public: |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 CertificateTableDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent){} |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 /** |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 * @brief Renders the delegate using the given painter and options. |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 * |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 * @param painter The painter to draw the item. |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 * @param option The style options. |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 * @param index The model index of the item to draw. |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 */ |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 void paint(QPainter *painter, const QStyleOptionViewItem &option, |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 const QModelIndex &index) const; |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 const QModelIndex &index) const; |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 void setEditorData(QWidget *editor, const QModelIndex &index) const; |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 void setModelData(QWidget *editor, QAbstractItemModel *model, |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 const QModelIndex &index) const; |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 void updateEditorGeometry(QWidget *editor, |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 const QStyleOptionViewItem &option, const QModelIndex &index) const; |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 private: |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 /** |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 * @brief Draw the item using the given parameters. |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 * |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 * @param painter The painter to draw the item. |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 * @param option The style options. |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 * @param index The model index of the item to draw. |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 * @param icon The icon to display. |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 * @param font The font used to draw text. |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 */ |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 QWidget *drawComboBox(QWidget *parent, const QStyleOptionViewItem &option, |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
55 const QModelIndex &index) const; |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 }; |
dde533ba4fcc
Added table item delegate for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 #endif |