[Interest] Add row to model *with data*?

Matthew Woehlke mwoehlke.floss at gmail.com
Thu Aug 15 23:42:21 CEST 2019

So... I have a (subclass of) QAbstractItemModel. This class internally
represents data using some other container, which has specific
requirements on both the item, and on the order of items. Thus, I can't
just add rows anywhere and with no data, to be filled in later.

My users are intended to work with *just* the QAbstractItemModel API. (I
eventually expect to have multiple model implementations.)

Is there any way, with the existing QAbstractItemModel API, to specify
the data that the row should contain in the same call that adds the row?
Even better, is there any way to ask the model to add a row, with data,
but *not* specify where the row is to be added? (The model would then
return the new row index, or -1 if it could not complete the operation
as requested.)

If not, is this something that would make sense to add?


More information about the Interest mailing list