def rowCount(self, parent):
        """ Returns the number of rows under the given parent. When the parent is valid it means that rowCount is returning the number of children of parent.
        """

        if parent.column() > 0:
            return 0

        if not parent.isValid():
            parentItem = self.root
        else:
            parentItem = parent.internalPointer()

        return parentItem.childCount()
def rowCount ( self , parent ) : if parent . column ( ) > 0 : return 0 if not parent . isValid ( ) : parentItem = self . root else : parentItem = parent . internalPointer ( ) return parentItem . childCount ( )
Returns the number of rows under the given parent. When the parent is valid it means that rowCount is returning the number of children of parent.