from my observations (in Qt 4.8), the layout*()
signals will fire when sorting the proxy model, but not if you implement filtering. also the docs explicitly refer to the order of items that are meant by these signals, and filtering naturally doesn't change the order but affects rows only.
in this case only the rows*(...)
signals (inserted, removed, etc.) will fire, depending on what the filter just did. the downside is, if the filter is applied recursively (usually it is), these signals will fire in masses, so will not be useful to tie to a single resulting action.
to overcome this you could call invalidate() after setting filters (not invalidateFilter btw, since it also won't fire the layout signals).
since this re-applies filtering and sorting (the latter wouldn't be necessary when filtering, but can't be avoided), the layout*()
signals will fire after both did end.
but then it would be better to handle the filter string/regExp/whatever on your own instead using the base methods (like setFilterFixedString(...)
) to set them, to at least avoid filtering twice - not much overhead anyway if you already re-implemented the filterAcceptsRow(...)
.
an alternative way would be to emit an own signal when setting sorting or filter, and connecting to it by using Qt::QueuedConnection
to make sure it is executed after filtering did end. that's what i finally did (to update a register of the table) and as far i can tell it works like expected.