You need either to call QSortFilterProxyModel::invalidateFilter() whenever your model changes or to set the dynamicSortFilter property to true (warning: slow).
You need either to call QSortFilterProxyModel::invalidateFilter() whenever your model changes or to set the dynamicSortFilter property to true (warning: slow).
Well, if you do not use those features, they hopefully won't use too much processing power ;-)
The source model does not have to emit dataChanged() if only a new row has been added. That is what rowsInserted() is for.
akiross (13th November 2008)
Oops! You're so right! I forgot about rowsInserted.
Anyway that was just a test, the problem remains: view isn't updated correctly (both on row insertion and data changing)...
Am I supposed to forward the signals when using abstract proxy models?The signals and slots used by the model/view framework ensure that each view is updated appropriately no matter how many proxy models are placed between itself and the source model.
Your proxy has to tell the view all the view needs to know.
So, unless your proxy does not show a row that has been modified or inserted, yes, you will need to forward those signals.
Bookmarks