When does TreeViewItem::removeSubItem actually delete its sub?

Could it be that when calling removeSubItem() the sub item isn't actually immediately destructed? I'm depending on the destructor of the sub item for some things to happen, but it doesn't seem to get called at the right moment.

It will definitely be deleted immediately.

Ah, then the problem seems to be with the component that is returned from createItemComponent(). I guess the tree manages those, then?

Like it says in the comments, yes.