Thanks for the help. I've read up on mutable and tried all sorts of dirty workarounds that couldnt do it....
Now I am (back) to a more sensible approach I think: I set all top-level-items visible in filterAcceptsRow() and when rowsRemoved() is emitted I check whether a top-level remains empty to remove it then.
Unfortunately that doesnt work either... here's the code: (the slot is connected to rowsRemoved(..):
void rowsWereRemoved
(const QModelIndex & parent,
int start,
int end
) {
if (parent
!= QModelIndex()) /// ! toplevel is being removed if (!hasChildren(parent))
removeRow(parent.row(), parent.parent());
}
void rowsWereRemoved(const QModelIndex & parent, int start, int end)
{
if (parent != QModelIndex()) /// ! toplevel is being removed
if (!hasChildren(parent))
removeRow(parent.row(), parent.parent());
}
To copy to clipboard, switch view to plain text mode
It causes a segfault on filtering immediately leaving completely unusable dumps....
So far all my attempts segfault as soon as a row is removed
Is there something fundamentally flawed with my syntax?
Thanks for your help!!
Bookmarks