summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/MUCSearch/QtLeafSortFilterProxyModel.cpp')
-rw-r--r--Swift/QtUI/MUCSearch/QtLeafSortFilterProxyModel.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/Swift/QtUI/MUCSearch/QtLeafSortFilterProxyModel.cpp b/Swift/QtUI/MUCSearch/QtLeafSortFilterProxyModel.cpp
new file mode 100644
index 0000000..b8cf15a
--- /dev/null
+++ b/Swift/QtUI/MUCSearch/QtLeafSortFilterProxyModel.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <Swift/QtUI/MUCSearch/QtLeafSortFilterProxyModel.h>
+
+namespace Swift {
+
+QtLeafSortFilterProxyModel::QtLeafSortFilterProxyModel(QObject* parent) : QSortFilterProxyModel(parent) {
+
+}
+
+QtLeafSortFilterProxyModel::~QtLeafSortFilterProxyModel() {
+
+}
+
+bool QtLeafSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const {
+ if (!sourceModel()->hasChildren(sourceModel()->index(source_row, 0, source_parent))) {
+ return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
+ }
+ else {
+ return true;
+ }
+}
+
+}