diff options
Diffstat (limited to 'mappingtreewidget.h')
-rw-r--r-- | mappingtreewidget.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/mappingtreewidget.h b/mappingtreewidget.h index d72dffa..9fe5739 100644 --- a/mappingtreewidget.h +++ b/mappingtreewidget.h @@ -8,7 +8,8 @@ #ifndef MAPPINGTREEWIDGET_H #define MAPPINGTREEWIDGET_H -#include <QtWidgets/QDialog> +#include <QDialog> +#include <QSortFilterProxyModel> #include "smtreeview.h" @@ -16,9 +17,10 @@ class MappingTreeView; class MappingTreeModel; class QComboBox; class QCheckBox; -class QSortFilterProxyModel; class QStringListModel; class MappingTreeResultModel; +class QLineEdit; +class MappingTreeProxy; // defined in mappingtreemodel.h struct MappingData; @@ -44,6 +46,8 @@ class MappingTreeWidget : public QWidget { void editChild(); void selectionChanged(); void moveChild(); + void filter(); + void clearFilter(); signals: void mappingChanged(int); @@ -52,9 +56,12 @@ class MappingTreeWidget : public QWidget { const QModelIndex selected() const; MappingTreeView *mTree; MappingTreeModel *mModel; - QSortFilterProxyModel *mProxy; + MappingTreeProxy *mProxy; QStringListModel *mTypesModel; QComboBox *mTypeBox; + QLineEdit *mFilter; + QPushButton *mDoFilter; + QPushButton *mClearFilter; QPushButton *mAddType; QPushButton *mDeleteType; QAction *mAddChildA; @@ -124,4 +131,19 @@ class MappingEditDialog : public QDialog { QPushButton *mCancel; }; +class MappingTreeProxy : public QSortFilterProxyModel { + Q_OBJECT + public: + explicit MappingTreeProxy(QObject *parent = 0); + + public slots: + void setFilter(const QString &filter); + + protected: + virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; + + private: + QRegExp mFilter; +}; + #endif // MAPPINGTREEWIDGET_H |