06-24-2012 09:46 PM
If I've set up a DataModel with 10 items, for example, then a slot executes with the intent of adding 10 more items to this ListView, how would I got about doing this in an educated way?
I'm under the impression a ListView can handle more than one DataModel? I'd hate to do that, since then I'd need to maintain a list of DataModels, due to no limit to the amount of times the SLOT could be called.
What is the correct way (if it's even feasible) to simply add entries to a DataModel, then update the ListView to reflect those changes, preferably without reparsing the components of the DataModel that are already displayed. The DataModel has and itemAdded SIGNAL which makes me think this is probably a feasible use case, however, I'm expecting to see something like an "update" in the ListView object and I'm not finding it.
06-24-2012 10:09 PM
The best I can do right now is clearing the data model, adding the first 10 items + the new 10 items to the data model, calling list->resetDataModel(), then list->setDataModel(&model), which will re-render the list will all of the new items.
I suppose to make it 'feel' more correct I could also call scrollToItem on the list to go to the new data.
This is definitely a less than ideal solution to simply adding to the data model and having the ListView handle it gracefully. This is more computationally expensive then I'd like.
06-25-2012 09:46 AM
This does not sound like the correct approach to me.
Please read knowledge base articles
and let us know if you can figure it out from there or have more questions.
These articles don't directly answer your question but should help.