def onItem_expanded(self, item): AbstractTree.onItem_expanded(self, item) #--- if item.childCount() == 0: self.refresh(item) if item.childCount() == 0: item.setChildIndicatorPolicy(QTreeWidgetItem.DontShowIndicatorWhenChildless)