python - Getting Selected Rows Count in QTableWidget - PyQt -


in python plugin, i'm developing, need retrieve number of selected rows in qtablewidget. can loop through each row of qtablewidget , check them whether selected or not. instead, there straightforward way selected rows count of qtablewidget in pyqt?

something like:

qtablewidget.selectedrowscount()

if want number of rows fully selected (i.e. when clicking on row header):

len(tablewidget.selectionmodel().selectedrows()) 

but if want rows have at least 1 cell selected:

len(set(index.row() index in tablewidget.selectedindexes())) 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

c# SetCompatibleTextRenderingDefault must be called before the first -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -