ensure document objects claims in tree

It is possible that a newly reated document object already claims other existing objects. The tree needs to be recomputed in this case.
This happens for example for the origin, which creates its planes and axis first and claims them before its own viewprovider is created.
This commit is contained in:
Stefan Tröger
2015-10-15 08:16:42 +02:00
parent 03ad4d752c
commit 35a5727474

View File

@@ -908,6 +908,11 @@ void DocumentItem::slotNewObject(const Gui::ViewProviderDocumentObject& obj)
item->setIcon(0, obj.getIcon());
item->setText(0, QString::fromUtf8(displayName.c_str()));
ObjectMap[objectName] = item;
// it may be possible that the new object claims already existing objects. If this is the
// case we need to make sure this is shown by the tree
if(!obj.claimChildren().empty())
slotChangeObject(obj);
}else {
Base::Console().Warning("DocumentItem::slotNewObject: Cannot add view provider twice.\n");
}