comparison src/includeemptysortmodel.h @ 88:3916cb3c9105

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