Important: Please read the Qt Code of Conduct -

Find out when filtering is doing in QSortFilterProxyModel

  • Hi guys..
    I've used a QSortFilterProxyModel. Now in filtering the tableview (by setFilterRegExp), i want to find out it somehow by model itself. But there isn't nothing such signal in QSortFilterProxyModel that emitted in this case. How can i find out when the filtering is doing?!

  • Filtering will be done as and when required and requested by View.

    What is that you want know from the Model?

  • I want to know when the filtering is done in QSortFilterProxyModel.(If there is a signal or something like that in SFPM model).
    suppose i have a proxy model and when the filtering is done i want to have data in proxy model (for example its rowCount). The only way that i can do this is by connecting a signal from proxyModel to a slot. So i'm seeking for such a that signal or a way to implement this in my customProxyModel. How can i do this? Is there any other way or signal?
    Thanks a lot :)

  • There is no such mechanism, even if it were there it would only create in-consistant results.

    I belive you want to know information like how many items have passed the filter test, or similar filtering outcoume information. In that case, you need have control over when and where setFilterRegExp() is called. Once this filrter is set emit a signal or call rowCount() on model etc....

  • Yes i know and that works. but i thought that may be a wrong design to do that.

  • bq. but i thought that may be a wrong design to do that.

    What makes you think so? I don't think so as long we are talking abould Qt's MVC

  • Ok Thanks :) Problem resolved :)

Log in to reply