转载自https://blog.csdn.net/qiangzi4646/article/details/80244433?utm_source=blogxgwz9
https://bbs.csdn.net/topics/360256155
不得不说这个方法真的很牛逼!
这恐怕是最简单的写法了,逛论坛发现的,亲测好用
//ui 文件中定义 //QTreeWidget *treeWidget; //... //遍历treeWidget QTreeWidgetItemIterator it(ui.treeWidget); while (*it) { //do something like (*it)->text(0); ++it; }