TreeModel is different from QStringListModel, QSqlTableModel, etc. The latter maintains a model instance, and the data (understandable) is directly initialized into the model, while the TreeModel in the demo creates and maintains an instance of a tree-structured TreeItem, in TreeModel::setModelData The parent->insertChildren operation is recursively performed on the root node (TreeItem* rootItem).
===========================================
Note: The TreeItem in the demo is a tree structure. The data stored in each node is consistent with the structure of the item designed in the View and Model, but it is not similar to a QTableWidgetItem object in QTableWidget.
===========================================
demo screenshot