Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED]i want to do sth when i expand or collapse a QTreeWidgetItem
opengpu2 last edited by opengpu2
i want to do sth when i expand or collapse a QTreeWidgetItem.
i saw there are publis SLOTS in the QTreeWidget, and i override them in my inherit class, but it donot work.
i will try signal itemExpanded/Collapsed, and i guess it will work.but, i will send the signal to the slot in the same class, from this to this.
i want to know what is the normal way to do this?
If you are talking about e.g. collapseItem then it's normal yours is not called, it's not a virtual slot. Also, it's not a slot that reacts on the collapse of an item but that does it. You should connect itemExpanded to a custom slot named e.g. onItemExpanded.