Pyqt clears all branch methods under an QTreeewidgetItem

  • 2021-06-28 13:23:42
  • OfStack

1. Cyclic deletion


# I selected this one 1 Processing for right-click emptying of branches 
for i in range(self.tree.currentItem().childCount()):
  self.tree.currentItem().removeChild(self.tree.currentItem().child(0))

As above, a branch is processed by cyclically deleting it.


Related articles: