From 35a5727474691831550affc56746a969a0b38579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Tr=C3=B6ger?= Date: Thu, 15 Oct 2015 08:16:42 +0200 Subject: [PATCH] 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. --- src/Gui/Tree.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index c68bf9bf3a..ca4c8ff017 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -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"); }