0

我正在尝试使用 QtDesigner 学习 PyQt4 和 GUI 设计。我已经设计了基本的 GUI,现在我想捕捉用户单击列标题的时间。

我的想法是我需要重写 QTableWidget,但我不知道如何附加到信号。到目前为止,这是我的课程:

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!"

但是,在 onClick 中设置断点,什么都没有触发。

有人能帮帮我吗?

TIA 迈克

4

1 回答 1

2

好的,需要的信号是:

self.connect(self.horizontalHeader(), SIGNAL('sectionClicked(int)'), self.onClick)
于 2009-09-11T00:42:18.960 回答