Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Updating a proxy model
This post is deleted!
If the source model has been implemented correctly, it should be done automatically.
What is your use case ?
KlimichKartorGnusov last edited by
@SGaist For update the source model i use a signal:
QAbstractItemModel::dataChange(const QModelIndex & topLeft, const QModelIndex & bottomRight)
Necessary something else?
What modification are you doing ? Through setData ?
@SGaist I use a custom method instead setData(). The changes are simple. Swap 1 to 0. After all is done, i emit a signal dataChange. Row which contains 1, should be in the proxy model, but is not happens. I must call the invalidate method that would update the proxy model. Why dataChange signal in source model is not enough?
Without seeing your code it's pretty much Crystal Ball Debugging. Can you share the implementation of that method ?
@SGaist Source code isn't contains mistakes. I change an object from the source data from the outside by an editor widget and for update model, i emit a signal dataChanged.
As I understand it, after this proxy model must call protected method filterAcceptsRow for a changed row but it isn't happens. For update i must call a invalidate method, that is not good, because will be processed all row from the source model. Maybe i something don't understand?
Like I said, without seeing any code I can't comment on whether the wrong index is being used or something else is going on.