[PyQt] Get a list of selected rows in a QTableWidget

starglider develop starglider.dev at gmail.com
Fri Mar 5 21:03:16 GMT 2010


Thank you Andreas for your suggestion.


On 5 March 2010 07:22, Andreas Pakulat <apaku at gmx.de> wrote:

> On 04.03.10 17:52:01, Russell Valentine wrote:
> > rows=[]
> > for idx in self.table.selectedIndexes()
> >       rows.append(idx.row())
>
> Better would be using self.table.selectionModel().selectedRows(), the
> above can add duplicates to your list of rows if multiple columns are
> selected.
>
> Andreas
>
> --
> Accent on helpful side of your nature.  Drain the moat.
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100305/fd2ea5de/attachment.html>


More information about the PyQt mailing list