[Interest] Why doesn't my model filter update?
Matthew Woehlke
mwoehlke.floss at gmail.com
Tue Feb 18 22:17:00 CET 2020
On 18/02/2020 15.35, Matthew Woehlke wrote:
> I have a QAbstractItemModel. I also have a QSortFilterProxyModel acting
> as a filter for the model, which in turn is used to feed a QTreeView.
> The filter accepts or rejects rows based on a custom data role of the
> source model.
>
> However, when the source model's data changes, the tree view does not
> update, and the filter's filterAcceptsRow is never called. What could I
> be doing wrong?
>
> The filter *does* have filterRole set correctly, and *does* have
> dynamicSortFilter set. (filterKeyColumn isn't set, but I'm using 0, and
> anyway setting it to -1 had no effect.) I've verified that the source
> model is emitting dataChanged() and is not blocking signals.
>
> The filter setup is at
> https://github.com/Kitware/seal-tk/blob/master/sealtk/gui/AbstractItemRepresentation.cpp#L47-L48.
> The model dataChanged is emitted at
> https://github.com/Kitware/seal-tk/blob/master/sealtk/core/AbstractProxyModel.cpp#L135.
Sigh... I found the problem.
I wonder if anyone else can spot it? ;-)
(Hint: it's near one of the bits of code linked above.)
--
Matthew
More information about the Interest
mailing list