int aIdx;
int aCount = 0;
int aSize = myChildren.size();
+ int aShift = 0;
while (i < aSize) {
aCount++;
aNode = myChildren.at(i);
aObject = aNode->object();
if (aObject.get()) {
- aIdx = aObject->document()->index(aObject, true);
+ aIdx = aObject->document()->index(aObject, true) + aShift;
if (aIdx != i) {
myChildren.removeAll(aNode);
myChildren.insert(aIdx, aNode);
continue;
}
}
+ else
+ aShift++;
i++;
// To avoid unlimited cycling
if (aCount > aSize * aSize)
const std::list<std::pair<std::shared_ptr<ModelAPI_Document>, std::string>>& aMsgGroups =
aUpdMsg->groups();
std::list<std::pair<std::shared_ptr<ModelAPI_Document>, std::string>>::const_iterator aIt;
- for (aIt = aMsgGroups.cbegin(); aIt != aMsgGroups.cend(); aIt++)
+ bool isRebuildTree = false;
+ for (aIt = aMsgGroups.cbegin(); aIt != aMsgGroups.cend(); aIt++) {
+ if (aIt->second == ModelAPI_Folder::group())
+ isRebuildTree = true;
QTreeNodesList aList = myRoot->objectsDeleted(aIt->first, aIt->second.c_str());
+ }
+ if (isRebuildTree)
+ myRoot->update();
rebuildDataTree();
}
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {