Unsolved How do I modify the data of a node in a qtreeview
-
How do I modify the data of a node in a qtreeview?thanks
-
@canid
What do you mean? YourQTreeView
has an associatedmodel()
(https://doc.qt.io/qt-5/qabstractitemview.html#model), that is where the data comes from and needs to be modified. Or are you asking about how you do it interactively from the treeview, or what? -
@jonb
I found that I could only modify the data in a single column of a row, and there was no way to modify the multi-column data in a row of the treeview -
@canid said in How do I modify the data of a node in a qtreeview:
I found that I could only modify the data in a single column of a row, and there was no way to modify the multi-column data in a row of the treeview
Get the QModelIndex of the cell that you want to modify (for example, when you click on a cell the
QAbstractItemView::clicked(QModelIndex)
signal is emitted)Once you have the index, call
QAbstractItemModel::setData(QModelIndex, QVariant)