[Moved] QTreeWidget ’Collapse/Expand all Same-Level’ Items
I have an existing app utilizing a QTreeWidget
and i want to add a context menu to it containing things like
‘Collapse/Expand all Same-Level Entries’ where it would collapse or expand all ‘folder’ entries at the same depth as the currently selected item, but only inside the same ‘folder’ as the currently selected item.
Is there a way to do this without completely rewriting the code?
A simpler method might be to use QWidget::addAction [doc.trolltech.com] to create a custom context menu. In the connected slot you can get the current or the selected item(s) and do the appropriate work.