You can't do this with a QSortFilterProxyModel because as soon as you return false from the filterAcceptsRow() method (which you would for the row containing the parent "A", since you don't want to display it), the proxy model will ignore all children of that row. So there is no way to -not- display a parent row while displaying a subset of the children of that row.

I think you will have to implement a new tree model derived from QAbstractProxyModel as a base. In non-checked mode, this is simply an identity model which calls the tree model. In checked mode, you will have to do your filtering.

If you can find it, there used to be a FlatProxyModel in the KDE sources (files kptflatproxymodel.[h, cpp]) that flattened a tree model into a flat table model. This basically added extra columns for the parents to every leaf node, duplicating the parent information for each child row. Every level of the tree must have the same number of columns otherwise the behavior is undefined. You could probably adapt this to do what you want.