code: def rowCount(self, parentIndex=QtCore.QModelIndex()):
          
          parentItem = self.getItem(parentIndex, altItem=self.invisibleRootItem)
          return parentItem.nChildren()
docs: 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.
  
              Note: When implementing a table based model, rowCount() should return 0 when the parent
              is valid.