I'm new to Qt and I was trying to update the data of a QTreeWidget
. The QTreeWidget
is created by Qt Creator (using drag and drop).
The QTreeWidget
I created is as below.
1
a A
b A
c C
2
x X
y Y
z Z
I need to update the 2nd column of 2nd row A to B in run-time using code.
b A
to
b B
Anyone knows how to update the value? As I created the QTreeWidget in ui designer. The Widget name is treeWidget.
Based on the QTreeWidget
and QTreeWidgetItem
documentation, you can do it as follows:
treeWidget->topLevelItem(0)->child(1)->setText(1, "B")