I have a QTableWidget
of 5 columns with horizontal headers.
I need to launch a function when header of column 4 is clicked. Currently, I have a working solution that consists of calling this function for every header clicked and then parsing the index and test if it's the right column.
Here is the current code:
self.table = QtGuiWidgets.QTableWidget()
self.table.horizontalHeader().sectionClicked.connect(self.onHeaderClicked)
def onHeaderClicked(self, logicalIndex):
if logicalIndex == 4:
print "ok"
Is there a way to avoid calling this function on every header click but just calling it when the right column header is clicked?