summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/MUCSearch/QtLeafSortFilterProxyModel.h')
-rw-r--r--Swift/QtUI/MUCSearch/QtLeafSortFilterProxyModel.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/Swift/QtUI/MUCSearch/QtLeafSortFilterProxyModel.h b/Swift/QtUI/MUCSearch/QtLeafSortFilterProxyModel.h
new file mode 100644
index 0000000..b4be622
--- /dev/null
+++ b/Swift/QtUI/MUCSearch/QtLeafSortFilterProxyModel.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <QSortFilterProxyModel>
+
+namespace Swift {
+
+/**
+ * @brief The QtLeafSortFilterProxyModel class is similar to the QSortFilterProxyModel
+ * class. While the basic QSortFilterProxyModel class filters all hierarchical items,
+ * the QtLeafSortFilterProxyModel class will only filter on items without children.
+ */
+class QtLeafSortFilterProxyModel : public QSortFilterProxyModel {
+ Q_OBJECT
+
+public:
+ QtLeafSortFilterProxyModel(QObject* parent = nullptr);
+ virtual ~QtLeafSortFilterProxyModel();
+
+protected:
+ virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
+};
+
+}