@Qt-Enthusiast Ok so I used QStandardItemModel as an example, obviously adapt to your model. :)

As for expanding only small "a" and "d", you add that to your expanded() function logic. You get the QModelIndex and then you can just check if it is the one you need to populate or not.. Something like:

void MyWidget::somethingExpanded(const QModelIndex &index) { if (myModel->myItemName(index) == "a" || myModel->myItemName(index) == "d") { // add your items to your model here } }