- for (aIt = aMsgGroups.cbegin(); aIt != aMsgGroups.cend(); aIt++)
- QTreeNodesList aList = myRoot->objectsDeleted(aIt->first, aIt->second.c_str());
+ emit beforeTreeRebuild();
+ for (aIt = aMsgGroups.cbegin(); aIt != aMsgGroups.cend(); aIt++) {
+ aList.append(myRoot->objectsDeleted(aIt->first, aIt->second.c_str()));
+ }
+ // Remove obsolete nodes
+ QTreeNodesList aRemaining;
+ foreach(ModuleBase_ITreeNode* aNode, aList) {
+ if (myRoot->hasSubNode(aNode))
+ aRemaining.append(aNode);
+ }
+ // Update remaining nodes
+ foreach(ModuleBase_ITreeNode* aNode, aRemaining) {
+ if (aNode->parent())
+ aNode->parent()->update();
+ }