Ejemplo n.º 1
0
    def mapSelectionToSource(self, proxySelection):
        sourceSelection = QItemSelection()
        if self.sourceModel() is None:
            return sourceSelection

        cursor = proxySelection.constBegin()
        end = proxySelection.constEnd()
        while cursor != end:
            topLeft = self.mapToSource(cursor.topLeft())
            bottomRight = self.mapToSource(cursor.bottomRight())
            sourceRange = QItemSelectionRange(topLeft, bottomRight)
            sourceSelection.append(sourceRange)
            cursor += 1
        return sourceSelection
Ejemplo n.º 2
0
    def mapSelectionToSource(self, proxySelection):
        sourceSelection = QItemSelection()
        if self.sourceModel() is None:
            return sourceSelection

        cursor = proxySelection.constBegin()
        end = proxySelection.constEnd()
        while cursor != end:
            topLeft = self.mapToSource(cursor.topLeft())
            bottomRight = self.mapToSource(cursor.bottomRight())
            sourceRange = QItemSelectionRange(topLeft, bottomRight)
            sourceSelection.append(sourceRange)
            cursor += 1
        return sourceSelection
Ejemplo n.º 3
0
    def mapSelectionFromSource(self, sourceSelection):
        proxySelection = QItemSelection()
        if self.sourceModel() is None:
            return proxySelection

        cursor = sourceSelection.constBegin()
        end = sourceSelection.constEnd()
        while cursor != end:
            topLeft = self.mapFromSource(cursor.topLeft())
            bottomRight = self.mapFromSource(cursor.bottomRight())
            proxyRange = QItemSelectionRange(topLeft, bottomRight)
            proxySelection.append(proxyRange)
            cursor += 1
        return proxySelection
Ejemplo n.º 4
0
    def mapSelectionFromSource(self, sourceSelection):
        proxySelection = QItemSelection()
        if self.sourceModel() is None:
            return proxySelection

        cursor = sourceSelection.constBegin()
        end = sourceSelection.constEnd()
        while cursor != end:
            topLeft = self.mapFromSource(cursor.topLeft())
            bottomRight = self.mapFromSource(cursor.bottomRight())
            proxyRange = QItemSelectionRange(topLeft, bottomRight)
            proxySelection.append(proxyRange)
            cursor += 1
        return proxySelection