Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Set a text of cell in QTreeWidget
Hello, please how is possible to set a text in QTreeWidget? For example I would like to set a text "hello" at index [3,2] (row,column).
Like on this picture below, instead of "10" set text "hello":
Chrisw01 last edited by
have you tried setText() of the item?
t0msk last edited by t0msk
Thanks so it pass a column number and text, but how can I tell which row? I need to get QTreeWidgetItem from QTreeWidget somehow.
Chrisw01 last edited by Chrisw01
IIRC each row is a topLevelItem with children under them so in this case Hello is the topLevelItem and branches on from there.
So Day would be the child of nice which is a child of hello.
QTreeWidgetItem *item = ui->treeWidget->topLevelItem(row)->child(row)->child(row); // in this case row = 0 item->setText(col, "TEXT"); // where in this case col would be 1
or something along those lines.
Ah now, I understand.
Thank you very much :)