Hi all, I've used QSortFilterProxyModel in the past, but it was quite a while ago and now I'm a little confused by the advice given in the docs.
The description of the dynamicSortFilter property [1] reads: "Note that you should not update the source model through the proxy model when dynamicSortFilter is true. For instance, if you set the proxy model on a QComboBox, then using functions that update the model, e.g., addItem(), will not work as expected. An alternative is to set dynamicSortFilter to false and call sort() after adding items to the QComboBox. The default value is true." I can't remember this restriction from when I've worked with it before, and in the class description, underneath the second code snippet, it says: "Any changes made through the QSortFilterProxyModel are applied to the original model." As if it is safe to update the model through the QSFPM at this point, even if it is speaking of one where dynamicSortFilter is true (the default). Surely it must be possible to use a QSFPM with dynamicSortFilter set to true as the model of some view which also provides editing (and consequently will make its changes through the QSFPM)? Or is that simply not a supported use case? If I use dynamicSortFilter, must I always make my changes to the source model? Grateful for any advice, Elvis [1] http://doc.qt.io/qt-5/qsortfilterproxymodel.html#dynamicSortFilter-prop [2] http://doc.qt.io/qt-5/qsortfilterproxymodel.html#details _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest