(view)
return rows, cols
Return the selected row and column indices of the selection in view.
Return the selected row and column indices of the selection in view.
Return the selected row and column indices of the selection in view .
def get_selection(view):
        """
        Return the selected row and column indices of the selection in view.
        """
        selmodel = view.selectionModel()

        selection = selmodel.selection()
        model = view.model()
        # map through the proxies into input table.
        while isinstance(model, QAbstractProxyModel):
            selection = model.mapSelectionToSource(selection)
            model = model.sourceModel()

        assert isinstance(selmodel, BlockSelectionModel)
        assert isinstance(model, TableModel)

        row_spans, col_spans = selection_blocks(selection)
        rows = list(itertools.chain.from_iterable(itertools.starmap(range, row_spans)))
        cols = list(itertools.chain.from_iterable(itertools.starmap(range, col_spans)))
        rows = numpy.array(rows, dtype=numpy.intp)
        # map the rows through the applied sorting (if any)
        rows = model.mapToSourceRows(rows)
        rows = rows.tolist()
        return rows, cols
def get_selection ( view ) : selmodel = view . selectionModel ( ) selection = selmodel . selection ( ) model = view . model ( ) # map through the proxies into input table. while isinstance ( model , QAbstractProxyModel ) : selection = model . mapSelectionToSource ( selection ) model = model . sourceModel ( ) assert isinstance ( selmodel , BlockSelectionModel ) assert isinstance ( model , TableModel ) row_spans , col_spans = selection_blocks ( selection ) rows = list ( itertools . chain . from_iterable ( itertools . starmap ( range , row_spans ) ) ) cols = list ( itertools . chain . from_iterable ( itertools . starmap ( range , col_spans ) ) ) rows = numpy . array ( rows , dtype = numpy . intp ) # map the rows through the applied sorting (if any) rows = model . mapToSourceRows ( rows ) rows = rows . tolist ( ) return rows , cols