I have created a treewidget and I have added some treewidgetitems which is editable.
My goal is now to catch the new value of the item after entering it.
Here is the code:
QTreeWidgetItem* child = new QTreeWidgetItem();
child->setText(0, "New Folder");
child->setText(1, "--");
child->setText(2, "--");
child->setFlags(child->flags() | Qt::ItemIsEditable);
item[0]->addChild(child);
item[0]->setExpanded(true);
MyTree->editItem(child);
MyTree->setCurrentItem(child);
...
When "editItem" is set, I can on the interface enter manuel the new value. What I need is to be able the catch the new value after I press "enter" key. When the item become editable the name is "New Folder", the text is selected and I enter a new name such as "blabla" and press enter.
I need to catch the "blabla". I have tried using the code below:
....
MyTree->setCurrentItem(child);
QList<QTreeWidgetItem *> item;
item = MyTree->selectedItems();
QString str = item[0]->text(0);
QByteArray latin_str = str.toLatin1();
char *utf8_text = latin_str.data();
but the utf8_text report "New Folder" instead of "blabla"
Any idea ?