Mercurial > trustbridge
annotate ui/certificatetablemodel.h @ 369:78eec57bc133
merged.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 15 Apr 2014 09:44:54 +0200 |
parents | 9ba7b4b4c1de |
children | 9731d28b95af |
rev | line source |
---|---|
334
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
1 #ifndef CERTIFICATETABLEMODEL_H |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 #define CERTIFICATETABLEMODEL_H |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
4 /** |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 * @file certificatetablemodel.h |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
6 * @brief Table model for certificates. |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
7 */ |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 #include <QAbstractTableModel> |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 #include <QString> |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 #include "certificate.h" |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 class CertificateTabelModel : public QAbstractTableModel |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 { |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 Q_OBJECT |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 public: |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 CertificateTabelModel(QObject *parent = 0); |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 |
358
9ba7b4b4c1de
Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
348
diff
changeset
|
20 void addCertificate(const Certificate &certificate, bool editable); |
334
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 int rowCount(const QModelIndex &parent = QModelIndex()) const; |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 int columnCount(const QModelIndex &parent = QModelIndex()) const; |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
348
e6aa82466420
Use the table item delegate for certificates and make the model editable.
Raimund Renkert <rrenkert@intevation.de>
parents:
342
diff
changeset
|
25 bool setData(const QModelIndex &index, const QVariant &value, |
e6aa82466420
Use the table item delegate for certificates and make the model editable.
Raimund Renkert <rrenkert@intevation.de>
parents:
342
diff
changeset
|
26 int role = Qt::EditRole); |
334
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 QVariant headerData(int section, Qt::Orientation orientation, |
348
e6aa82466420
Use the table item delegate for certificates and make the model editable.
Raimund Renkert <rrenkert@intevation.de>
parents:
342
diff
changeset
|
28 int role = Qt::DisplayRole) const; |
e6aa82466420
Use the table item delegate for certificates and make the model editable.
Raimund Renkert <rrenkert@intevation.de>
parents:
342
diff
changeset
|
29 |
e6aa82466420
Use the table item delegate for certificates and make the model editable.
Raimund Renkert <rrenkert@intevation.de>
parents:
342
diff
changeset
|
30 Qt::ItemFlags flags(const QModelIndex &index) const; |
334
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 private: |
342
fba80767fd7a
Fixed member variables in certificate table model.
Raimund Renkert <rrenkert@intevation.de>
parents:
334
diff
changeset
|
33 QList<Certificate> certificates; |
fba80767fd7a
Fixed member variables in certificate table model.
Raimund Renkert <rrenkert@intevation.de>
parents:
334
diff
changeset
|
34 QList<QString> header; |
334
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 }; |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 |
36be67070dcb
Added table model for certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 #endif |