comparison 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
comparison
equal deleted inserted replaced
87:3b3a1384eb5f 88:3916cb3c9105
10 #include <QWidget> 10 #include <QWidget>
11 #include <QMap> 11 #include <QMap>
12 12
13 class QSortFilterProxyModel; 13 class QSortFilterProxyModel;
14 class QComboBox; 14 class QComboBox;
15 class QCheckBox;
15 class QLineEdit; 16 class QLineEdit;
16 /** 17 /**
17 * @class FilterWidget 18 * @class FilterWidget
18 * @brief Generic Widget to apply a filter on SortFilterProxymodel 19 * @brief Generic Widget to apply a filter on SortFilterProxymodel
19 */ 20 */
20 class FilterWidget: public QWidget 21 class FilterWidget: public QWidget
21 { 22 {
22 Q_OBJECT 23 Q_OBJECT
23 24
24 public: 25 public:
25 /**@brief construct a filterwidget for the model model.*/ 26 /**@brief construct a filterwidget for the model model.
26 FilterWidget (QSortFilterProxyModel *model, 27 *
28 * @param model The model to filter
29 * @param addWithEmptyChk wether or not to add the include empty checkbox.
30 * */
31 FilterWidget (QSortFilterProxyModel *model, bool addWithEmptyChk,
27 QWidget * parent = 0, Qt::WindowFlags f = 0); 32 QWidget * parent = 0, Qt::WindowFlags f = 0);
28 33
29 Q_SIGNALS: 34 Q_SIGNALS:
30 void filterHasChanged(); 35 void filterHasChanged();
31 36
37 void includeEmptyChanged(int state);
38
32 protected: 39 protected:
33 void setupGUI(); 40 void setupGUI();
34 41
35 protected slots: 42 public slots:
36 void headersChanged(); 43 void headersChanged();
37 44
45 protected slots:
38 void filterChanged(); 46 void filterChanged();
39 47
40 private: 48 private:
41 QSortFilterProxyModel *mModel; 49 QSortFilterProxyModel *mModel;
42 QComboBox *mCombo; 50 QComboBox *mCombo;
51 QCheckBox *mEmptyChk;
43 QLineEdit *mEditLine; 52 QLineEdit *mEditLine;
44 /* Maps the combo index to the model col index */ 53 /* Maps the combo index to the model col index */
45 QMap<int, int> mColFilterMap; 54 QMap<int, int> mColFilterMap;
55 bool mWithEmptyChk;
46 }; 56 };
47 #endif // FILTERWIDGET_H 57 #endif // FILTERWIDGET_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)