The tree view asks the model about the child count (rowCount) of each node. If the count is greater than 0 then the node will be visualized as expandable.
When the user expands that node, the view will ask for the children.

Since you are working with a model that stores all data in itself, you'll have to build the model that way, i.e. recurse through the data structure and create items accordingly.

Cheers,
_