Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QAbstractItemModel - Am i doing it right?
GrahamL last edited by
I have just started with QAbstractItemModel and have some doubts as to whether I am doing things in the correct way.
I have class that (amongst other things) is storing a set of data that I want to display in a QTreeView.
So I made a model class derived from QAbstractItemModel and have then attached this model to my QTreeView which does show the data correctly and allows the user to edit the values.
As expected when an edit is completed my setData method gets called and I can set the relevant items data.
However, this does not update the underlying data and I am struggling to see how this is done.
I would be grateful if someone could
a) confirm that I am doing things correctly
b) explain how the underlying data is typically updated