Best way to reparent a lot of QTreeWidgetItem
-
Hi guys,
I have a little performance issue using QTreeWidget & reparenting a lot of QTreeWidgetItems, and i'm wondering if there's an efficient way of doing that.
Right now, i don't see any other way than :
for each items to move
removeChild() to take the item from it's parent
addChild() to the new parent
Depending on the current state of the item in the tree (expanded or not), it takes a lot of time to process.
I'm speaking about reparenting things like 10000 items each time.
Did anyone tried something similar and have a better way to handle it ?
Thanks for any help !
-
BTW, i tried to encapsulate the loop described above with :
treeWidget->setUpdatesEnabled(false);
[...]
treeWidget->setUpdatesEnabled(true);it helps a little but it's not enough to be "real-time". I guess my only option would be to lower the number of calls :-/
-
i quickly checked the source code around remove/add, it seems a lot of code can handle batch remove/adds but i don't see any way to access it.
Is there something i'm missing ?