For the life of me I cant figure this out. I have a table set up, and in row 0 col 0 I have a checkbox. If that checkbox is not clicked I want to disable row 1, col 0. Otherwise if clicked, enable row 1 col 0.
To disable it I've been using flags:
if not self.example_table.cellWidget(0,0).isChecked():
flags = QtCore.Qt.ItemFlags()
flags != QtCore.Qt.ItemIsEnabled
# flags != QtCore.Qt.ItemIsEditable (This also works to disable it)
self.example_table.item(1,0).setFlags(flags)
The problem is that when I try and make an else with the inverse, it will not re-enable the cell. Here is what I've tried.
else:
flags = QtCore.Qt.ItemFlags()
flags == QtCore.Qt.ItemIsEnabled #(still doesnt work)
# flags = QtCore.Qt.ItemIsEnabled (didnt work)
# flags == QtCore.Qt.ItemIsEditable (didnt work)
# flags = QtCore.Qt.ItemIsEditable (didnt work)
self.tblActivityInfo.item(1, 0).setFlags(flags)
No matter what I try, the cell at 1,0 remains disabled.
self.example_table is just a QtWidgets.QTableWidget(self.centralwidget)