Beispiel #1
0
    def index(self, row, column, i_parent=None):
        parent = self._root if not i_parent or not i_parent.isValid(
        ) else i_parent.internalPointer()

        if not QAbstractItemModel.hasIndex(self, row, column, i_parent):
            return QModelIndex()

        child = parent.child(row)
        return QAbstractItemModel.createIndex(
            self, row, column, child) if child else QModelIndex()
Beispiel #2
0
    def index(self, in_row, in_column, in_parent=None):
        if not in_parent or not in_parent.isValid():
            parent = self._root
        else:
            parent = in_parent.internalPointer()
        if not QAbstractItemModel.hasIndex(self, in_row, in_column, in_parent):
            return QModelIndex()

        child = parent.child(in_row)
        if child:
            return QAbstractItemModel.createIndex(self, in_row, in_column,
                                                  child)
        else:
            return QModelIndex()
Beispiel #3
0
    def index(self, row, column, parent=None):
        if parent.isValid():
            p = parent.internalPointer()
        else:
            p = self.root

        if not QAbstractItemModel.hasIndex(self, row, column, parent):
            return QModelIndex()

        child = p.child(row)
        if child:
            return QAbstractItemModel.createIndex(self, row, column, child)
        else:
            return QModelIndex()
Beispiel #4
0
    def index(self, row, column, parent_index=None):
        if not parent_index:
            parent_index = QModelIndex()
        if not parent_index.isValid():
            parent = self._root
        else:
            parent = parent_index.internalPointer()

        if not QAbstractItemModel.hasIndex(self, row, column, parent_index):
            return QModelIndex()

        if child := parent.child(row):
            index = QAbstractItemModel.createIndex(self, row, column, child)
            if 'Geometry' in child._data:
                self.geo_index = index
            if 'Setups' in child._data:
                self.setup_index = index
            if hasattr(child, 'entity'):
                self.indexes[str(child.entity)] = index
            return index