Where are the itemChecked and itemUnchecked signals on a QTreeWidget ?
Qt Signals: (quote from PyQt4 QTreeWidget documentation page) void currentItemChanged (QTreeWidgetItem *,QTreeWidgetItem *) void itemActivated (QTreeWidgetItem *,int) void itemChanged (QTreeWidgetItem *,int) void itemClicked (QTreeWidgetItem *,int) void itemCollapsed (QTreeWidgetItem *) void itemDoubleClicked (QTreeWidgetItem *,int) void itemEntered (QTreeWidgetItem *,int) void itemExpanded (QTreeWidgetItem *) void itemPressed (QTreeWidgetItem *,int) void itemSelectionChanged ()
At the moment, I solved it as follows:
self.treeWidget.itemClicked.connect (self.handle) def handle (item, column): print 'emitted!', item.text(column) if item.checkState(column) == QtCore.Qt.Checked:
But this is a bad decision for me, because itemClicked publishes in so many cases. It is emitted when left / right clicks on the text of an element, which is absolutely unnecessary (I have heavy functions inside self.handleChecked and unnecessary calls from them when opening the context menu are pretty lousy).
Well, I also tried using itemChanged :
self.treeWidget.itemChanged.connect (self.handle)
but in this case the situation is even worse! The self.handle function calls itself recursively to infinity and beyond, because my functions inside self.handleChecked change the data of the element, and this signal emits again and again. In addition, I need a signal that is emitted only when the flag is switched.
Can someone tell me what I'm doing wrong?