code: def removeAllChildrenAtIndex(self, parentIndex):
          
          if not parentIndex.isValid():
              logger.debug("No valid item selected for deletion (ignored).")
              return
  
          parentItem = self.getItem(parentIndex, None)
          logger.debug("Removing children of {!r}".format(parentItem))
          assert parentItem, "parentItem not found"
  
          #firstChildRow = self.index(0, 0, parentIndex).row()
          #lastChildRow = self.index(parentItem.nChildren()-1, 0, parentIndex).row()
          #logger.debug("Removing rows: {} to {}".format(firstChildRow, lastChildRow))
          #self.beginRemoveRows(parentIndex, firstChildRow, lastChildRow)
  
          self.beginRemoveRows(parentIndex, 0, parentItem.nChildren()-1)
          try:
              parentItem.removeAllChildren()
          finally:
              self.endRemoveRows()
  
          logger.debug("removeAllChildrenAtIndex completed")
docs: Removes all children of the item at the parentIndex.
              The children's finalize method is called before removing them to give them a
              chance to close their resources