Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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