the model's NameFilters has changed( i print them after setNameFilters() ensure this ), but treeview did not refresh.
the model's NameFilters has changed( i print them after setNameFilters() ensure this ), but treeview did not refresh.
I'm asking whether the model's data changed not whether the object's property value changed. The view probably didn't refresh because the model didn't change.
sry for my misunderstanding ,the model's data did not changed, but when i change QFileSystemModel to QDirModel, treeview refreshed after NameFilters changed
Maybe QDirModel refreshes itself after name filters is changed and QFileSystemModel doesn't. I think it's high time to go beyond "it doesn't work for me" state. As for now you don't even know what doesn't work so how do you expect us to help you.
thx for your patient.
i think this is why treeview did not refresh, i tried two ways to refresh treeview:QDirModel refreshes itself after name filters is changed and QFileSystemModel doesn't
1. make a new instance of QFileSystemModel, setModel this new instance and restore treeviews state, (it's a bit lag to restore expanded nodes, and it's a bit hard to restore node which colume number other than 0 )
2. refresh the model Manually: i tried emit signal dataChanged() of model(give current index to it), but treeview did not refresh, may be i need to emit every node's dataChanged() signal
Last edited by vertusd; 25th November 2010 at 04:56.
Name filters is a filter method applied to existing nodes, it does not cause the whole model to be repopulated with new data. If you applied a name filter and it didn't change the data available in the model then it means the new filter reveals the same set of data as the old one. Which points us to a conclusion that you are doing something wrong in your code which causes two different filters to have the same result.
Bookmarks