Pyqt清空某一个QTreeewidgetItem下的所有分支

版权声明:本文为博主原创文章,转载请注明出处。 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))

如上,采用循环删除某一个分支的方法进行处理。

猜你喜欢

转载自blog.csdn.net/qq_37887537/article/details/82623671