为什么我的 QTreeWidgetItem 不可编辑?我用这段代码来实现一个:
ui->treeWidget->expandAll();
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, "Add details about your Bug");
bug->addChild(item);
ui->treeWidget->editItem(item, 0);
您忘记在 QTreeWidgetItem 中将 editable 设置为 true (默认为 false):
ui->treeWidget->expandAll();
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, "Add details about your Bug");
item->setFlags(item->flags() | Qt::ItemIsEditable);
bug->addChild(item);
ui->treeWidget->editItem(item, 0);