PDA

View Full Version : Abort/Cancel filter/sort in QSortFilterProxyModel or derivative



olzzen
10th September 2013, 10:22
Hi folks,

perhaps anybody could give me a hint on how to cancel an active filtering or sorting in a QSortFilterProxyModel or in a derived class?!

Imagine the following: You have a very large model and the user wants to filter that model on some regexp. The seconds went by while the model is filtered and now the user wants to stop the active filtering, perhaps via a progressdialogs's cancel button, or by pressing the escape key.

How can we achieve the abortion of an active filtering? It seems to me that there are no special functions to tell the proxy to stop filtering or sorting...

Thanks in advance
olzzen

wysota
10th September 2013, 10:56
You cannot do that. Filtering with a sort filter proxy model is a synchronous operation. If you want an asynchronous operation, you have to implement filtering/sorting yourself by subclassing and reimplementing virtual methods.

olzzen
10th September 2013, 11:37
Ok, i see.

What do you mean, is it a simple and stupid solution to "processEvents" from within the "filterAcceptsRow"-Method and to test for an escape key-event. Then, if this event has occured, all further calls to "filterAcceptsRow" will return true...

BTW: Is the abortion of an active filtering not a valid and often use-case which Qt should have been considered when implementing the sort/filter proxy-model?