Hmmm this is driving me nuts.... here are my attempts at "prefiltering"
I have a member
QMap <qint64, bool> visibleTable;
that saves internalPointer<->visiblity;
This is the extra function
bool QBrowseViewFilterModel::myFilterAcceptsRow(int sourceRow,
{
QModelIndex index0
= sourceModel
()->index
(sourceRow,
0, sourceParent
);
bool show = false;
if (sourceModel()->hasChildren(index0))
{
for (int i = 0; i < sourceModel()->rowCount(index0); ++i)
if (myFilterAcceptsRow(i, index0))
show = true; /// if any child is visible keep this visible
} else
{
QModelIndex index1
= sourceModel
()->index
(sourceRow,
1, sourceParent
);
QModelIndex index2
= sourceModel
()->index
(sourceRow,
2, sourceParent
);
show = true;
if (!sourceModel()->data(index0).toString().contains(filterRegExp()))
show = false;
}
visibleTable.insert(index0.internalId(), show);
return show;
}
bool QBrowseViewFilterModel::myFilterAcceptsRow(int sourceRow,
const QModelIndex &sourceParent)
{
QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
bool show = false;
if (sourceModel()->hasChildren(index0))
{
for (int i = 0; i < sourceModel()->rowCount(index0); ++i)
if (myFilterAcceptsRow(i, index0))
show = true; /// if any child is visible keep this visible
} else
{
QModelIndex index1 = sourceModel()->index(sourceRow, 1, sourceParent);
QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent);
show = true;
if (!sourceModel()->data(index0).toString().contains(filterRegExp()))
show = false;
}
visibleTable.insert(index0.internalId(), show);
return show;
}
To copy to clipboard, switch view to plain text mode
the original filterAcceptsRow :
bool QBrowseViewFilterModel::filterAcceptsRow(int sourceRow,
{
QModelIndex index0
= sourceModel
()->index
(sourceRow,
0, sourceParent
);
return visibleTable[index0.internalId()];
}
bool QBrowseViewFilterModel::filterAcceptsRow(int sourceRow,
const QModelIndex &sourceParent) const
{
QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
return visibleTable[index0.internalId()];
}
To copy to clipboard, switch view to plain text mode
And I also overwrote invalidate and reset to actually start the recursion on the top-level-items:
void QBrowseViewFilterModel::reset()
{
visibleTable.clear();
for (int i = 0; i < sourceModel()->rowCount(); ++i)
myFilterAcceptsRow(i);
this->QSortFilterProxyModel::reset();
}
void QBrowseViewFilterModel::invalidate()
{
visibleTable.clear();
for (int i = 0; i < sourceModel()->rowCount(); ++i)
myFilterAcceptsRow(i);
this->QSortFilterProxyModel::invalidate();
}
void QBrowseViewFilterModel::reset()
{
visibleTable.clear();
for (int i = 0; i < sourceModel()->rowCount(); ++i)
myFilterAcceptsRow(i);
this->QSortFilterProxyModel::reset();
}
void QBrowseViewFilterModel::invalidate()
{
visibleTable.clear();
for (int i = 0; i < sourceModel()->rowCount(); ++i)
myFilterAcceptsRow(i);
this->QSortFilterProxyModel::invalidate();
}
To copy to clipboard, switch view to plain text mode
But now the table¹ is empty 
... I hope I am not doing anything stupid there right now.... it is getting kind of late....
Thanks for not giving up 
edit: ¹ I meant the view.
Bookmarks