Im working in a GUI project that is using QTreeWidget. The program parses through an XML and creates a tree to be displayed using the QTreeWidget.
I found a bug in the code, where if the user changes to a new selection, then back to the one they were just on, it re-parses the XML as it should, but the previous tree that was created is not being destroyed first.
The new tree is simply appended onto the old tree and then it is now displaying duplicates of everything. If you continue to change views and back again it will keep appending onto the tree n number of times.
I have tried using TreeWidget->clear(), but this looks like it only clears what is being displayed and is not actually deleting the tree itself.
I have seen examples on line of people talking about using delete topLevelItem() but i have not been able to make this work either.
Is there anyone out there who knows a proper way to delete and entire tree from a QTreeWidget?
Thanks.