qtqt5qstandarditemmodelqstandarditem

Is QStandardItemModel::removeRows() recursive?


When calling removeRows() on QStandardItemModel with tree structure does this free the memory for all the children QStandartItems recursively?


Solution

  • Is QStandardItemModel::removeRows() recursive?

    No. It can't be since a model isn't a tree of models.

    does this free the memory for all the children QStandartItems recursively?

    Yes, but this has little to do with removeRows(). The ~QStandardItem() destructor disposes of the children. So any method that destroys a QStandardItem will also destroy and dispose of the children. Nothing will leak.