Hi all,
I search on the previous post does not go well, so I'm asking here a probabibly basic question.
My table has 6 columns, the last one is populated by buttons.
I would like to know with row is associated to the button clicked by the user.
I know that I can get the cell selected:
self.table.cellClicked.connect(self.cell_was_clicked)
self.table.cellClicked.connect(self.cell_was_clicked)
To copy to clipboard, switch view to plain text mode
but this does not work with the click on the buttons: the click on button needs their module to be specified in the connect.
The table is populate in a for loop like this:
rowPos=self.table.rowCount()
self.table.insertRow(rowPos)
self.table.setCellWidget(rowPos,5,showBtn)
rowPos=self.table.rowCount()
self.table.insertRow(rowPos)
self.table.setItem(rowPos,0,QTableWidgetItem(str(status)))
self.table.setItem(rowPos,1,QTableWidgetItem(str(snapshotID)))
self.table.setItem(rowPos,2,QTableWidgetItem(str(avdPath)))
self.table.setItem(rowPos,3,QTableWidgetItem(str(filename)))
self.table.setItem(rowPos,4,QTableWidgetItem(str(filetype)))
self.table.setCellWidget(rowPos,5,showBtn)
To copy to clipboard, switch view to plain text mode
Thanks in advance
M
Added after 5 minutes:
self.table.currentRow() is the answer.
M
Bookmarks