版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/qq_37887537/article/details/82623671
1.循环删除
#这个是我选中其中的一个分支进行右键清空操作时进行的处理
for i in range(self.tree.currentItem().childCount()):
self.tree.currentItem().removeChild(self.tree.currentItem().child(0))
如上,采用循环删除某一个分支的方法进行处理。