How to rename a child with only parent index known in a treeview ?
-
I am working on a
QStandardItemModelwith only theindexof parent know how can i rename the child.
I usedsetItemwith parentrowand column as1it returns0Model->setItem(row,1,item);I even tried
setDatabut it works only for parentui->treeView->model()->setData(parentIndex,new_name,Qt::EditRole);How can i rename a child with only parent index known in a treeview?
-
I am working on a
QStandardItemModelwith only theindexof parent know how can i rename the child.
I usedsetItemwith parentrowand column as1it returns0Model->setItem(row,1,item);I even tried
setDatabut it works only for parentui->treeView->model()->setData(parentIndex,new_name,Qt::EditRole);How can i rename a child with only parent index known in a treeview?
@Ratzz
Hello,
Retrieve the child model index first with QModelIndex::child and then set your data.Kind regards.
-
@Ratzz
Hello,
Retrieve the child model index first with QModelIndex::child and then set your data.Kind regards.
@kshegunov
Thanks for your reply.
Yes retrieving the child model viachildand then setting data worked for me .