如何在qt中用代码添加treewidget控件
时间: 2023-06-06 19:08:59 浏览: 109
QT+TreeWidget 节点添加删除修改源码
你可以通过以下代码在Qt中添加TreeWidget控件:
```c++
QTreeWidget *treeWidget = new QTreeWidget(ui->centralWidget);
treeWidget->setObjectName(QStringLiteral("treeWidget"));
treeWidget->setGeometry(QRect(10, 10, 256, 192));
QTreeWidgetItem *headerItem = treeWidget->headerItem();
headerItem->setText(0, QApplication::translate("MainWindow", "Tree Widget Header", nullptr));
```
阅读全文