PDA

View Full Version : QSortFilterProxyModel invalidateFilter() vs. reset()



mdomke
28th September 2010, 12:23
Hello *,

I have a subclass of a QSortFilterProxyModel which I use for filtering of a large amount of data (~ 200.000 entries). Every time the filter routine has finished I used to call reset() so that the view would reload the data. I used reset() instead of invalidateFilter() because the documentation explicitly suggests that:



If you are working with large amounts of filtering and have to invoke invalidateFilter() repeatedly, using reset() may be more efficient, depending on the implementation of your model. However, reset() returns the proxy model to its original state, losing selection information, and will cause the proxy model to be repopulated.


However, since I upgraded to Qt 4.7 this approach doesn't work anymore. The view does not request any data after the model-reset has been performed. invalidateFilter() works for me, but is very slow in comparison with the version that uses reset(). I found out that invalidate() does the job and is considerably faster than invalidateFilter(). Does anybody have a clue why reset() is not working anymore?

Matthi
15th December 2010, 12:44
I noticed this, too. reset() doesn't seem to work anymore to invalidate the filter settings in QSortFilterProxyModel since QT 4.7.

nightghost
15th December 2010, 16:20
just an idea: how is the performance if you reset() the source model?