Mercurial > retraceit
annotate src/filterwidget.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 | 098a10fc2e83 |
children |
rev | line source |
---|---|
4
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
1 #ifndef FILTERWIDGET_H |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
2 #define FILTERWIDGET_H |
25
64a51a42c01f
Assign copyright correctly
Andre Heinecke <andre.heinecke@intevation.de>
parents:
14
diff
changeset
|
3 /* Copyright (C) 2015 by ETH Zürich |
64a51a42c01f
Assign copyright correctly
Andre Heinecke <andre.heinecke@intevation.de>
parents:
14
diff
changeset
|
4 * Software engineering by Intevation GmbH |
4
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
5 * |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
6 * This file is Free Software under the GNU GPL (v>=2) |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
7 * and comes with ABSOLUTELY NO WARRANTY! |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 * See LICENSE.txt for details. |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
9 */ |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
10 #include <QWidget> |
14
315e6988952a
Only add entries that do not start with # to filter
Andre Heinecke <andre.heinecke@intevation.de>
parents:
4
diff
changeset
|
11 #include <QMap> |
4
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
12 |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
13 class QSortFilterProxyModel; |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
14 class QComboBox; |
88
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
15 class QCheckBox; |
4
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
16 class QLineEdit; |
66
098a10fc2e83
Add doxygen files and improve doxygen comments
Andre Heinecke <andre.heinecke@intevation.de>
parents:
28
diff
changeset
|
17 /** |
098a10fc2e83
Add doxygen files and improve doxygen comments
Andre Heinecke <andre.heinecke@intevation.de>
parents:
28
diff
changeset
|
18 * @class FilterWidget |
098a10fc2e83
Add doxygen files and improve doxygen comments
Andre Heinecke <andre.heinecke@intevation.de>
parents:
28
diff
changeset
|
19 * @brief Generic Widget to apply a filter on SortFilterProxymodel |
098a10fc2e83
Add doxygen files and improve doxygen comments
Andre Heinecke <andre.heinecke@intevation.de>
parents:
28
diff
changeset
|
20 */ |
4
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
21 class FilterWidget: public QWidget |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
22 { |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
23 Q_OBJECT |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
24 |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
25 public: |
88
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
26 /**@brief construct a filterwidget for the model model. |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
27 * |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
28 * @param model The model to filter |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
29 * @param addWithEmptyChk wether or not to add the include empty checkbox. |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
30 * */ |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
31 FilterWidget (QSortFilterProxyModel *model, bool addWithEmptyChk, |
4
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
32 QWidget * parent = 0, Qt::WindowFlags f = 0); |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
33 |
28
4e16fbd10945
(issue3-5) Make the default sort order configurable
Andre Heinecke <andre.heinecke@intevation.de>
parents:
25
diff
changeset
|
34 Q_SIGNALS: |
4e16fbd10945
(issue3-5) Make the default sort order configurable
Andre Heinecke <andre.heinecke@intevation.de>
parents:
25
diff
changeset
|
35 void filterHasChanged(); |
4e16fbd10945
(issue3-5) Make the default sort order configurable
Andre Heinecke <andre.heinecke@intevation.de>
parents:
25
diff
changeset
|
36 |
88
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
37 void includeEmptyChanged(int state); |
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
38 |
4
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
39 protected: |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
40 void setupGUI(); |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
41 |
88
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
42 public slots: |
4
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
43 void headersChanged(); |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
44 |
88
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
45 protected slots: |
4
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
46 void filterChanged(); |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
47 |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
48 private: |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
49 QSortFilterProxyModel *mModel; |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
50 QComboBox *mCombo; |
88
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
51 QCheckBox *mEmptyChk; |
4
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
52 QLineEdit *mEditLine; |
14
315e6988952a
Only add entries that do not start with # to filter
Andre Heinecke <andre.heinecke@intevation.de>
parents:
4
diff
changeset
|
53 /* Maps the combo index to the model col index */ |
315e6988952a
Only add entries that do not start with # to filter
Andre Heinecke <andre.heinecke@intevation.de>
parents:
4
diff
changeset
|
54 QMap<int, int> mColFilterMap; |
88
3916cb3c9105
Add new FilterSort model that allows to include empty values
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
55 bool mWithEmptyChk; |
4
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
56 }; |
e4748da7140b
Add filter functionalty to metadataview
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
57 #endif // FILTERWIDGET_H |