Question

I'm trying to learn PyQt4 and GUI design with QtDesigner. I've got my basic GUI designed, and I now want to capture when the user clicks on a column header.

My thought is that I need to override QTableWidget, but I don't know how to attach to the signal. Here's my class so far:

class MyTableWidget(QtGui.QTableWidget):
    def __init__(self, parent = None):
        super(MyTableWidget, self).__init__(parent)
        self.connect(self, SIGNAL('itemClicked(QTreeWidgetItem*)'), self.onClick)

    def onClick(self):
        print "Here!"

But, setting a breakpoint in the onClick, nothing is firing.

Can somebody please help me?

TIA Mike

Was it helpful?

Solution

OK, the SIGNAL needed is:

self.connect(self.horizontalHeader(), SIGNAL('sectionClicked(int)'), self.onClick)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top