Mercurial > retraceit
annotate src/includeemptysortmodel.h @ 96:a9e72af2e6fa 1.2
(Auto) Update translations
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 29 Jun 2015 15:40:19 +0200 |
parents | 07e1e47954f6 |
children |
rev | line source |
---|---|
88
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
1 #ifndef INCLUDEEMPTYSORTMODEL_H |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
2 #define INCLUDEEMPTYSORTMODEL_H |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
3 /* Copyright (C) 2015 by ETH Zürich |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
4 * Software engineering by Intevation GmbH |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
5 * |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
6 * This file is Free Software under the GNU GPL (v>=2) |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
7 * and comes with ABSOLUTELY NO WARRANTY! |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 * See LICENSE.txt for details. |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
9 */ |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
10 |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
11 /** |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
12 * @file metadataview.h |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
13 * @brief Table view of the meta data information |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
14 */ |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
15 /** |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
16 * @class IncludeEmptySortModel |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
17 * @brief Small wrapper around sort filter model to allow custom filtering |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
18 */ |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
19 #include <QModelIndex> |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
20 #include <QSortFilterProxyModel> |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
21 |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
22 class IncludeEmptySortModel : public QSortFilterProxyModel |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
23 { |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
24 Q_OBJECT |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
25 |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
26 public: |
94
07e1e47954f6
Default to include empty fields
Andre Heinecke <andre.heinecke@intevation.de>
parents:
88
diff
changeset
|
27 IncludeEmptySortModel() : QSortFilterProxyModel(), mIncludeEmpty(true) {} |
88
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
28 |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
29 /** @brief wrapper around the base class call that accepts empty |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
30 * values if includeEmpty is checked. */ |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
31 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
32 |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
33 public slots: |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
34 void setIncludeEmpty(int state) { |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
35 mIncludeEmpty = state != Qt::Unchecked; |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
36 invalidate(); |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
37 } |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
38 |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
39 private: |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
40 bool mIncludeEmpty; |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
41 }; |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
42 #endif // INCLUDEEMPTYSORTMODEL_H |