Check out the QSortFilterProxyModel class. I think that might be what you're looking for.

You subclass it and install an instance of it between your model and treeview. Whenever you need to, you simply change the state in your filter-object, so it will only pass on the subtree you want to see.