[Interest] Example for: QTreeView + QAbstractItemModel + external data

anton antonxx at gmx.de
Tue Apr 26 19:05:07 CEST 2016


I have subclassed QAbstractItemModel,
and I want to load additionally data in the model
as soon as somebody clicks on the [+] 
in the treeview to load the children of this 
item form an external data ( web- app which gives me json data back).

 I reimplemented hasChildren() in the model
but i am not sure about the moment to load the data.

I suppose that the rowCount() method of the model is called
when somebody expands an item in the view?
If not what is the moment when my model should ask for additional Data?

Does there exist a small example which demonstrates how to
handle this in an optimal way.
Not sure about beginInsertRows() or layoutChanged() ..
I am experimenting but i get also some crashes so an 
example project would be nice.



More information about the Interest mailing list