[Interest] Add row to model *with data*?
godboutj at amotus.ca
Fri Aug 16 15:27:43 CEST 2019
Maybe you can add a type to your model and make a map of type to Component, when initalizing the view element, use a Loader that will create the proper Item view based on your type. Not sure this is what you are looking for.
From: Interest <interest-bounces at qt-project.org> On Behalf Of Matthew Woehlke
Sent: August 15, 2019 5:42 PM
To: qt qt <interest at qt-project.org>
Subject: [Interest] Add row to model *with data*?
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?
Interest mailing list
Interest at qt-project.org
More information about the Interest