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
好的,需要的信号是:
self.connect(self.horizontalHeader(), SIGNAL('sectionClicked(int)'), self.onClick)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.