How do I implement interdependent models using Qt's Model-View framework? Specifically, how can I create a model that contains fields that reference data in another model? I want data that is changed/removed in the first model to propagate to the dependent field in the 2nd model.
Let's say for example I have a model called BookListModel
that contains a list of books. I have a second model called ReaderTableModel
that contains a list of readers (names) and the book that they are reading. I'd like these books to reference the corresponding index of BookListModel
, and any changes to propagate to the corresponding entry in ReaderTableModel
.
Does Qt have a mechanism for this? Can I store a QPersistentModelIndex
inside another model?