(1)tree->setColumnCount(1); 设置树显示的列数。
(2)tree->setHeaderLabel("Example");设置树的每一列的显示标题。
(3)tree->addTopLevelItem(note1);追加一个顶层树节点。
(4)tree->expand(tree->model()->index(1, 0));展开第1行0列的节点。
(5)note2->addChild(childtree1);在节点note2下添加一个子节点childtree1。
(6)void clicked ( const QModelIndex & index );它是树单击事件。
详细内容参考:https://blog.csdn.net/xgbing/article/details/7778856
原文:https://www.cnblogs.com/ProtocolYue/p/11437124.html