summaryrefslogtreecommitdiffstats
path: root/mappingtreewidget.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2013-10-13 07:25:50 +0200
committerArno <am@disconnect.de>2013-10-13 07:25:50 +0200
commite07de4e0a1bd56aab8f4ee81d6db252e442c3d7a (patch)
tree02b62d34152e481917ba1bef6a7191e4e3465c72 /mappingtreewidget.h
parent5beb56a09363197e23a630d3fd2f71899d7f00a0 (diff)
downloadSheMov-e07de4e0a1bd56aab8f4ee81d6db252e442c3d7a.tar.gz
SheMov-e07de4e0a1bd56aab8f4ee81d6db252e442c3d7a.tar.bz2
SheMov-e07de4e0a1bd56aab8f4ee81d6db252e442c3d7a.zip
Add filter bar to MappingTreeWidget
Move matchRecursive from ArchiveModel to SmTreeModel so we can use it here, too.
Diffstat (limited to 'mappingtreewidget.h')
-rw-r--r--mappingtreewidget.h28
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