Solved 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":
Thank you
-
Hi,
have you tried setText() of the item?
-
How?
function
ui->treeWidget->setText();
doesn't exist
-
Hi,
-
@SGaist said in Set a text of cell in QTreeWidget:
Hi,
Thanks so it pass a column number and text, but how can I tell which row? I need to get QTreeWidgetItem from QTreeWidget somehow.
-
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 :)