나는 Pyhthon과 Qt를 처음 사용하므로 기본적인 질문이다. 내가 원하는 것은 QTreeWidget에서 항목을 클릭하면 어떤 항목이 클릭되었는지 알려주는 이벤트 핸들러가 호출된다는 것입니다. 내가 노력 코드는 다음과 같습니다PyQt4에서 클릭에 반응하는 방법 QTreeWidget
self.dir_tree = QTreeWidget()
self.dir_tree.setColumnCount (3)
self.dir_tree.setHeaderLabels (("File", "Type", "Size"))
self.dir_tree.connect (dir_tree, SIGNAL ("itemClicked (QTreeWidgetItem*, int)"), self.onClickItem)
def onClickItem (self, column):
print (column)
이 실행되지 않는 오류 코드입니다 : 내가 잘못 뭐하는 거지
TypeError: arguments did not match any overloaded call:
QObject.connect(QObject, SIGNAL(), QObject, SLOT(),Qt.ConnectionType=Qt.AutoConnection): argument 1 has unexpected type 'function'
QObject.connect(QObject, SIGNAL(), callable, Qt.ConnectionType=Qt.AutoConnection): argument 1 has unexpected type 'function'
QObject.connect(QObject, SIGNAL(), SLOT(), Qt.ConnectionType=Qt.AutoConnection): argument 1 has unexpected type 'function'
? 그리고 이것과 관련된 질문 : 클릭 한 항목을 어떻게 알 수 있습니까?
이 튜토리얼을 찾을 수 없으므로 어떤 제안이라도 환영합니다.
도움 주셔서 감사합니다.