I am trying to display a branch of my tree model using QSortFilterProxyModel. I specified a tree node and tried to display all its offspring. I implemented the filterAcceptRows function. It did not work as I expected. The first index entering this function is the root element. filterAcceptRows returns false because I didn't select the root element as my branch. Then filterAcceptRows did not get called again. The only time this function works is when the root element is selected.

Am I missing other functions to implement? Does Qt assumes that, in a tree model, if the parent is not shown, none of its children can be displayed?