PDA

View Full Version : signal From QcheckBox inside QTreeWidget , itemChanged not working!



alkimia
29th September 2016, 23:23
Hi Everyone,

So I'm a QtreeWidget SubClass and QtreeWidgetItem SubClass , I'm adding 3 items with 3 columns :

1st: text
2nd: QComboBox Widget
3rd: QCheckBox Widget

I'm adding the the Qwidgets inside the QtreeWidgetItem subclass with self.treeWidget().setItemWidget() , now when I try to use the QtreeWidget.itemChanged it only picks up the changes in the text of the 1st Column is not picking up the signal when the ComboBox changes or when I tick the checkBox.


I try to do this the self.checkBox.stateChanged.connect(self.emitItemCh anged), which makes the QtreeWidget.itemChanged get the signal from the checkbox and comboBox , but is getting Column 0 ad the column changed always , when it should be Column 1 and Column 2(Combo, CheckBox) .


What can I do to fix this behaviour , what is happening? , how can I get the itemChanged to get the signal from this Widgets


thank you very much in Advance

alkimia
30th September 2016, 17:07
So what I ended up doing to make it work was self.checkBox.Statechange.connect(lambda: self.treeWidget().whenItemChange(self,3)) in the QtreeWidgetItem SubClass , whenItemChange(item,Column) is the Fucntion I call with the itemChanges in the QtreeWidget subclass, self.itemChanged.connec(self.whenItemChange). it feels kind of hacky to do this , but does the job, if somebody has a better solution please let me know.

cheers