I have to call expandAll() in the constructor, but that looks unnecessary,
The stuff I've added in form editor was just collapsed, and I failed to find an property in the right box, how should I make it all expanded by default?
You can write your own function to add items and then use it to fill the tree:
void addRootNode(const QString& value) {
QTreeWidgetItem* treeItem = new QTreeWidgetItem();
treeItem->setText(value);
ui->treeWidget->addTopLevelItem(treeItem);
ui->treeWidget->expandItem(treeItem);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With