Exemple #1
0
    def _apply_selection_to_full_row(self):
        rows = list()
        selection = QItemSelection()
        for idx in self.selectedIndexes():
            if idx.row() not in rows:
                rows.append(idx.row())
                selection.append(QItemSelectionRange(idx))

        self.selectionModel().select(
            selection,
            QItemSelectionModel.Rows | QItemSelectionModel.ClearAndSelect)
    def presetsIndexChanged(self, idx):
        self.savePreset.setEnabled(idx > 0)
        self.clearPreset.setEnabled(idx > 0)
        categories = self.presetModel.categoriesAtIndex(idx)
        selm = self.categoryList.selectionModel()
        cmodel = self.categoryList.model()
        catidxs = [
            cmodel.createIndex(row, 0, None)
            for row in range(cmodel.rowCount(None))
        ]

        qis = QItemSelection()
        for cidx in catidxs:
            if cmodel.idAtRow(cidx.row()) in categories:
                qir = QItemSelectionRange(cidx)
                qis.append(qir)
        selm.select(qis, QItemSelectionModel.ClearAndSelect)