I'm using QSortFilterProxyModel on a QTreeView, and I'm trying to filter both top level items and the first-level child items.
Is that possible? Seems like QSortFilterProxyModel only filter on top level items.
I'm using QSortFilterProxyModel on a QTreeView, and I'm trying to filter both top level items and the first-level child items.
Is that possible? Seems like QSortFilterProxyModel only filter on top level items.
Could you please provide more details on what you already tried? The doc says If a parent item doesn't match the filter, none of its children will be shown, which probably explain why it seems to filter only on first level.
If your goal is to filter only specific levels of your tree, you should subclass QSortFilterProxyModel and reimplement the filterAcceptRow. This way you can specify to ignore items that do not belong to specific tree levels. See the doc for more informations.