Just wanted to say that with some more reading and looking into the suggested example you gave, everything is working perfectly at the moment.

Initially I had some major problems with my application segfaulting. I think this was because Qt does not like it when I have the following code in the slot connected to the expand signal of the QTreeView:

beginRemoveRows(0,0)
remove fetching node (i.e. the first node)
endRemoveRows()

beginInsertRows(0,x)
insert the actual fetched nodes
endInsertRows()

Whenever I had the above code combined in the slot, every now and then I would get segfaults. If I left the removing of the "Fetching..." node out, everything was working without a problem.

In the current implementation however, this is not a problem anymore, as the fetching is done via another process that is communicated with via Dbus. This means that from the other process I first instruct to remove the Fetching node and after that instruct for the insertion of the fetched data. Because these are two different events, they are handled separately by the eventloop now.

Small demo to show that I really have it working can be found on my website.

Thanks for the help, I think I finally started to understand how the whole thing with QAbstractItemModel and QModelIndex is working.