示例#1
0
    def insertRows(self, position, rows, parent=QtCore.QModelIndex()):
        self.beginInsertRows(parent, position, position + rows - 1)

        for i in range(rows):
            self.__data.insert(position, '')

        self.endInsertRows()
        return True
示例#2
0
    def removeRows(self, position, rows, parent=QtCore.QModelIndex()):
        self.beginRemoveRows(parent, position, position + rows - 1)

        for i in range(rows):
            value = self.__data[position]
            self.__data.remove(value)

        self.endRemoveRows()
        return True
示例#3
0
 def insertNode(self, node=None, parent=QtCore.QModelIndex()):
     if parent.isValid() :
         childCount = parent.internalPointer().childCount()
     else:
         childCount = 0
     self.model.insertRows(childCount, 1, parent, node)
     new_index = self.model.index(childCount, 0, parent)
     self.addIndex(new_index, False)
     return new_index
示例#4
0
    def insertRows(self, position, rows, parent=QtCore.QModelIndex()):
        self.beginInsertRows(parent, position, position + rows - 1)

        for i in range(rows):
            default_values = ['' for i in range(self.columnCount(None))]
            self.__data.insert(position, default_values)

        self.endInsertRows()
        return True
示例#5
0
 def removeNode(self, row, parent=QtCore.QModelIndex()):
     if parent.isValid() :
         childCount = parent.internalPointer().childCount()
     else:
         childCount = 0
     
     for i in range(childCount) :
         child_index = self.model.index(i, 0, parent)
         self.removeIndex(child_index)
         self.model.removeRows(i, 1, parent)
示例#6
0
    def insertColumns(self, position, columns, parent=QtCore.QModelIndex()):
        self.beginInsertColumns(parent, position, position + columns - 1)

        rowCount = len(self.__data)

        for i in range(columns):
            for j in range(rowCount):
                self.__data[j].insert(position, '')

        self.endInsertColumns()

        return True
示例#7
0
    def removeColumns(self, position, columns, parent=QtCore.QModelIndex()):
        self.beginRemoveRows(parent, position, position + columns - 1)

        rowCount = len(self.__data)

        for i in range(columns):
            for j in range(rowCount):
                value = self.__data[j][position]
                self.__data[j].remove(value)

        self.endRemoveRows()
        return True