summaryrefslogtreecommitdiff
path: root/plugins/autotest/testtreemodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/autotest/testtreemodel.h')
-rw-r--r--plugins/autotest/testtreemodel.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/plugins/autotest/testtreemodel.h b/plugins/autotest/testtreemodel.h
index 72ecf88ff4..94cb874f8e 100644
--- a/plugins/autotest/testtreemodel.h
+++ b/plugins/autotest/testtreemodel.h
@@ -24,6 +24,7 @@
#include <cplusplus/CppDocument.h>
#include <QAbstractItemModel>
+#include <QSortFilterProxyModel>
namespace {
enum ItemRole {
@@ -71,7 +72,7 @@ public:
void removeQuickTestSubtreeByFilePath(const QString &file);
void addQuickTest(TestTreeItem *newItem);
void removeAllQuickTests();
- void removeUnnamedQuickTest(const QString &filePath);
+ bool removeUnnamedQuickTests(const QString &filePath);
signals:
void testTreeModelChanged();
@@ -89,6 +90,39 @@ private:
};
+class TestTreeSortFilterModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+public:
+ enum SortMode {
+ Alphabetically,
+ Naturally
+ };
+
+ enum FilterMode {
+ Basic,
+ ShowInitAndCleanup = 0x01,
+ ShowTestData = 0x02,
+ ShowAll = ShowInitAndCleanup | ShowTestData
+ };
+
+ TestTreeSortFilterModel(TestTreeModel *sourceModel, QObject *parent = 0);
+ void setSortMode(SortMode sortMode);
+ void setFilterMode(FilterMode filterMode);
+ void toggleFilter(FilterMode filterMode);
+ static FilterMode toFilterMode(int f);
+
+protected:
+ bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
+ bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+
+private:
+ TestTreeModel *m_sourceModel;
+ SortMode m_sortMode;
+ FilterMode m_filterMode;
+
+};
+
} // namespace Internal
} // namespace Autotest