(self, selection: Union[QItemSelection, QModelIndex],
               flags: QItemSelectionModel.SelectionFlags)
Reimplemented.
Reimplemented.
Reimplemented .
def select(self, selection: Union[QItemSelection, QModelIndex],
               flags: QItemSelectionModel.SelectionFlags) -> None:
        """Reimplemented."""
        if isinstance(selection, QModelIndex):
            selection = QItemSelection(selection, selection)

        if not self.__selectBlocks:
            super().select(selection, flags)
            return

        model = self.model()

        if flags & QItemSelectionModel.Current:  # no current selection support
            flags &= ~QItemSelectionModel.Current
        if flags & QItemSelectionModel.Toggle:  # no toggle support either
            flags &= ~QItemSelectionModel.Toggle
            flags |= QItemSelectionModel.Select

        if flags == QItemSelectionModel.ClearAndSelect:
            # extend selection ranges in `selection` to span all row/columns
            sel_rows = selection_rows(selection)
            sel_cols = selection_columns(selection)
            selection = QItemSelection()
            for row_range, col_range in \
                    product(to_ranges(sel_rows), to_ranges(sel_cols)):
                qitemselection_select_range(
                    selection, model, row_range, col_range
                )
        elif flags & (QItemSelectionModel.Select |
                      QItemSelectionModel.Deselect):
            # extend all selection ranges in `selection` with the full current
            # row/col spans
            rows, cols = selection_blocks(self.selection())
            sel_rows = selection_rows(selection)
            sel_cols = selection_columns(selection)
            ext_selection = QItemSelection()
            for row_range, col_range in \
                    product(to_ranges(rows), to_ranges(sel_cols)):
                qitemselection_select_range(
                    ext_selection, model, row_range, col_range
                )
            for row_range, col_range in \
                    product(to_ranges(sel_rows), to_ranges(cols)):
                qitemselection_select_range(
                    ext_selection, model, row_range, col_range
                )
            selection.merge(ext_selection, QItemSelectionModel.Select)
        super().select(selection, flags)
def select ( self , selection : Union [ QItemSelection , QModelIndex ] , flags : QItemSelectionModel . SelectionFlags ) -> None : if isinstance ( selection , QModelIndex ) : selection = QItemSelection ( selection , selection ) if not self . __selectBlocks : super ( ) . select ( selection , flags ) return model = self . model ( ) if flags & QItemSelectionModel . Current : # no current selection support flags &= ~ QItemSelectionModel . Current if flags & QItemSelectionModel . Toggle : # no toggle support either flags &= ~ QItemSelectionModel . Toggle flags |= QItemSelectionModel . Select if flags == QItemSelectionModel . ClearAndSelect : # extend selection ranges in `selection` to span all row/columns sel_rows = selection_rows ( selection ) sel_cols = selection_columns ( selection ) selection = QItemSelection ( ) for row_range , col_range in product ( to_ranges ( sel_rows ) , to_ranges ( sel_cols ) ) : qitemselection_select_range ( selection , model , row_range , col_range ) elif flags & ( QItemSelectionModel . Select | QItemSelectionModel . Deselect ) : # extend all selection ranges in `selection` with the full current # row/col spans rows , cols = selection_blocks ( self . selection ( ) ) sel_rows = selection_rows ( selection ) sel_cols = selection_columns ( selection ) ext_selection = QItemSelection ( ) for row_range , col_range in product ( to_ranges ( rows ) , to_ranges ( sel_cols ) ) : qitemselection_select_range ( ext_selection , model , row_range , col_range ) for row_range , col_range in product ( to_ranges ( sel_rows ) , to_ranges ( cols ) ) : qitemselection_select_range ( ext_selection , model , row_range , col_range ) selection . merge ( ext_selection , QItemSelectionModel . Select ) super ( ) . select ( selection , flags )