1. 异常 开启 ItemIsUserCheckable以后,界面上没有出现多选框。 QTreeWidgetItem *item = new QTreeWidgetItem();item->setText(0, "hello");item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsSelectable |Qt::ItemIsEnabled | Qt::ItemIsAutoTristate);ui->treeWidget->addTopLevelItem(item); 2. 正常 添加 item->setCheckState(0, Qt::Unchecked); QTreeWidgetItem *item = new QTreeWidgetItem();item->setText(0, "hello");item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsSelectable |Qt::ItemIsEnabled | Qt::ItemIsAutoTristate);item->setCheckState(0, Qt::Unchecked); //重要ui->treeWidget->addTopLevelItem(item);