def leafs(self, searchedIndex: QModelIndex) -> QModelIndexList:
     leafs = QModelIndexList()
     if searchedIndex.isValid():
         childCount = searchedIndex.model().columnCount(searchedIndex)
         for i in range(childCount):
             leafs += self.searchLeafs(searchedIndex.child(0, i))
     return leafs
 def searchLeafs(self, currentIndex: QModelIndex) -> QModelIndexList:
     res = QModelIndexList()
     if currentIndex.isValid():
         childCount = currentIndex.model().columnCount(currentIndex)
         if childCount:
             for i in range(childCount):
                 res += self.searchLeafs(currentIndex.child(0, i))
         else:
             res.push_back(currentIndex)
     return res
 def findLeaf(self, currentIndex: QModelIndex, sectionIndex: int,
              currentLeafIndex: int) -> QModelIndex:
     if currentIndex.isValid():
         childCount = currentIndex.model().columnCount(currentIndex)
         if childCount:
             for i in range(childCount):
                 res, currentLeafIndex = self.findLeaf(
                     currentIndex.child(0, i), sectionIndex,
                     currentLeafIndex)
                 if res.isValid():
                     return res, currentLeafIndex
         else:
             currentLeafIndex += 1
             if currentLeafIndex == sectionIndex:
                 return currentIndex, currentLeafIndex
     return QModelIndex(), currentLeafIndex