mcanonic
20th June 2019, 10:04
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_click ed)
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.setItem(rowPos,0,QTableWidgetItem(str(s tatus)))
self.table.setItem(rowPos,1,QTableWidgetItem(str(s napshotID)))
self.table.setItem(rowPos,2,QTableWidgetItem(str(a vdPath)))
self.table.setItem(rowPos,3,QTableWidgetItem(str(f ilename)))
self.table.setItem(rowPos,4,QTableWidgetItem(str(f iletype)))
self.table.setCellWidget(rowPos,5,showBtn)
Thanks in advance
M
Added after 5 minutes:
self.table.currentRow() is the answer.
M
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_click ed)
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.setItem(rowPos,0,QTableWidgetItem(str(s tatus)))
self.table.setItem(rowPos,1,QTableWidgetItem(str(s napshotID)))
self.table.setItem(rowPos,2,QTableWidgetItem(str(a vdPath)))
self.table.setItem(rowPos,3,QTableWidgetItem(str(f ilename)))
self.table.setItem(rowPos,4,QTableWidgetItem(str(f iletype)))
self.table.setCellWidget(rowPos,5,showBtn)
Thanks in advance
M
Added after 5 minutes:
self.table.currentRow() is the answer.
M