How to rename a child with only parent index known in a treeview ?
Solved
General and Desktop
-
I am working on a
QStandardItemModel
with only theindex
of parent know how can i rename the child.
I usedsetItem
with parentrow
and column as1
it returns0
Model->setItem(row,1,item);
I even tried
setData
but 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.