What does 'is not in the model' mean? I don't see why a model should do something when an index for anything which is not in it's source model changes...
What does 'is not in the model' mean? I don't see why a model should do something when an index for anything which is not in it's source model changes...
Source Model
Folder_1
|->Item_1
|->Item_2
Folder_2
|->Item_3
|->Item_4
ProxyModel
Item_1
Item_2
Item_3
Item_4
So basically the parent indexes from the source model (Folder_1 and Folder_2) are not in the Proxy Model.
I want to apply a filter to the proxy model, in the filterAcceptsRow method I check if the entry should be accepted in the model by checking if the entry matches the filter. Every time the filter changes I emit a filterChanged signal that will trigger a InvalidateFilter call that (in theory) will invoke that filterAcceptsRow method. The problem I have is that in this case filterAcceptsRow will never be called for some reason.
Looking into other forums for people that had similar issues I came across this answer:
I just understood that filterAcceptsRow get invoked only if parent of index is displayed in proxy model. Oherwise proxy model thinks that it is not worth to insert row in proxy model.
So it is just how Qt handles that kind of situations.
Hope this clarifies the issue.
thanks!
So the index is in the model and in the proxy model, it's just filtered out in the view.
If you call invalidateFilter() then a new filtering will be started. Also you don't pass any model index to filterChanged() at all so I don't understand what you're trying to say.
Please provide a *minimal* compilable example.
Bookmarks