If something causes say, a row to be inserted in the underlying data structure behind a QAbstractItemModel, what do I do? How do I let the QAbstractItemModel know that data was inserted so that views connected to it can be notified and updated?
At first I thought I should have the underlying data structure somehow trigger its attached QAbstractItemModel to emit rowsAboutToBeInserted just before the underlying data is modified, and rowsInserted afterwards. Except, the documentation for these two signals contains the following note:
> It can only be emitted by the QAbstractItemModel implementation, and cannot be explicitly emitted in subclass code.
Ok, so that means my own item models aren't allowed to signal that rows were inserted? I don't understand how this is useful, then...
Then there is also insertRows, which I can't understand the purpose of. This doesn't seem to be what I want. This seems to be a way to insert (blank, I guess?) rows in the underlying data via the model interface, which isn't what I'm trying to do (nor can I conceive of any situation in which this would be done).
I have data stored in a class. The data changes and an element is inserted. So how do I ultimately cause the attached view to reflect the change, since I'm not allowed to call rowsInserted()?
Bookmarks