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

Andreas Pakulat apaku at gmx.de
Fri Mar 5 07:22:06 GMT 2010


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.


More information about the PyQt mailing list