예제 #1
0
 def index(self, row, column, parent):
     if not self.hasIndex(row, column, parent):
         return Q.QModelIndex()
     if not parent.isValid():
         parentItem = self._rootItem
     else:
         parentItem = parent.internalPointer()
     childItem = parentItem.child(row)
     if childItem:
         return self.createIndex(row, column, childItem)
     else:
         return Q.QModelIndex()
예제 #2
0
    def parent(self, index):
        if not index:
            return Q.QModelIndex()
        if not index.isValid():
            return Q.QModelIndex()
        childItem = index.internalPointer()
        if not childItem:
            return Q.QModelIndex()

        parentItem = childItem.parent
        if not parentItem:
            return Q.QModelIndex()
        if parentItem is self._rootItem:
            return Q.QModelIndex()
        return self.indexForItem(parentItem)
예제 #3
0
 def __init__(self, *args, **kwargs):
     player = kwargs.pop('player', None)
     self._player = player
     super().__init__(*args, **kwargs)
     self._headerData = ["name", "value"]
     self._rootItem = TreeItem(name='root', player=player)
     self.setupModelData(player)
     print(self.__class__.__name__, 'rowCount() is ',
           self.rowCount(Q.QModelIndex()))
예제 #4
0
파일: av_player.py 프로젝트: gdkar/qtmpv
 def rowCount(self, parent=Q.QModelIndex()):
     return len(self._props)
예제 #5
0
파일: av_player.py 프로젝트: gdkar/qtmpv
 def columnCount(self, parent=Q.QModelIndex()):
     return 2