I found the answer from https://forum.qt.io/topic/20980/solved-can-qtreewidget-really-be-edited . Apparently each item needs to have its editable flag set.
To do it, I iterated over all of the items and set the editable flag:
QTreeWidgetItemIterator it(ui->treeWidget);
while (*it) {
(*it)->setFlags((*it)->flags() | Qt::ItemIsEditable);
++it;
}
It works after that!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.