Filter rows that did not leak anything in TopProxy.
authorMilian Wolff <mail@milianw.de>
Fri, 26 Feb 2016 17:15:44 +0000 (18:15 +0100)
committerMilian Wolff <mail@milianw.de>
Fri, 26 Feb 2016 17:15:44 +0000 (18:15 +0100)
gui/topproxy.cpp

index 0855256..f396337 100644 (file)
@@ -48,12 +48,20 @@ TopProxy::TopProxy(Type type, QObject* parent)
 
 TopProxy::~TopProxy() = default;
 
-bool TopProxy::filterAcceptsColumn(int source_column, const QModelIndex& source_parent) const
+bool TopProxy::filterAcceptsColumn(int source_column, const QModelIndex& /*source_parent*/) const
 {
     return source_column == TreeModel::LocationColumn || source_column == toSource(m_type);
 }
 
 bool TopProxy::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
 {
-    return !source_parent.isValid();
+    if (source_parent.isValid()) {
+        // only show top rows
+        return false;
+    }
+    if (m_type == Leaked && !sourceModel()->index(source_row, TreeModel::LeakedColumn).data(TreeModel::SortRole).toULongLong()) {
+        // don't show rows that didn't leak anything
+        return false;
+    }
+    return true;
 }