-bool NickViewFilter::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const {
- // root node, networkindexes, the bufferindex of the buffer this filter is active for and it's childs are accepted
- if(!source_parent.isValid())
- return true;
+bool NickViewFilter::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
+{
+ // root node, networkindexes, the bufferindex of the buffer this filter is active for and it's children are accepted
+ if (!(source_parent.isValid() && source_parent.model()))
+ return true;
+
+ QModelIndex source_child = source_parent.model()->index(source_row, 0, source_parent);
+ return (sourceModel()->data(source_child, NetworkModel::BufferIdRole).value<BufferId>() == _bufferId);
+}