how can i get the QTreeWidgetItem in its delegate's setModelData() func??
-
Normally in the delegate class we use the model() (QAbstractItemModel) which is provided in the functions that we override. However what you set to the model()->setData() it will automatically update the item (based on the roles : DisplayRole, UserRole etc). In order to access the data you can use model->data(index,Qt::DisplayRole).toString();
-
Both are the same for more details you can check the documentation QAbstractItemModel::parent(const QModelIndex & index) and QModelIndex::parent()
make sure that you check if the index isValid() then only proceed with next operation.