Skip to content

Commit

Permalink
Merge pull request #665 from realthunder/TreeViewFix
Browse files Browse the repository at this point in the history
TreeView: fixed disappearing item
  • Loading branch information
wwmayer committed Apr 2, 2017
2 parents 1bde451 + b42c45b commit 78d8272
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Gui/Tree.cpp
Expand Up @@ -1137,8 +1137,23 @@ void DocumentItem::populateItem(DocumentObjectItem *item, bool refresh) {
item->addChild(childItem);
}
}
for(auto childItem : oldItems)
for(auto childItem : oldItems) {
if (childItem->type() == TreeWidget::ObjectType) {
DocumentObjectItem* obj = static_cast<DocumentObjectItem*>(childItem);
// Add the child item back to document root if it is the only
// instance. Now, because of the lazy loading strategy, this may
// not truely be the last instance of the object. It may belong to
// other parents not expanded yet. We don't want to traverse the
// whole tree to confirm that. Just let it be. If the other
// parent(s) later expanded, this child item will be moved from
// root to its parent.
if(obj->myselves->size()==1) {
this->addChild(childItem);
continue;
}
}
delete childItem;
}
}

void DocumentItem::slotChangeObject(const Gui::ViewProviderDocumentObject& view)
Expand Down

0 comments on commit 78d8272

Please sign in to comment.