I use following code to put a checkbox in the 9th column of my QTableWidget
chkBoxItem = QtGui.QTableWidgetItem()
chkBoxItem.setFlags(QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
chkBoxItem.setCheckState(QtCore.Qt.Unchecked)
table.setItem(rowNo,9,chkBoxItem)
Where table is my QtTableWidget. I need to add the row where the checkbox is clicked to a list.. how on earth do I achieve this?
Kind regards,
解决方案
One way to do it would be:
connect the itemClicked signal of the table to a handler
test the checkedState of the clicked item in the handler
if the item is checked, add its row to the list
Example code:
from PyQt4 import QtGui, QtCore
class Window(QtGui.QWidg