From 0b39dfaf91658295e188c010127bafa468b76b4b Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 6 Feb 2015 16:44:47 +0100 Subject: moved setRoot to Document.cpp --- src/core/model/Document.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/core/model/Document.cpp') diff --git a/src/core/model/Document.cpp b/src/core/model/Document.cpp index f27da1d..fedd899 100644 --- a/src/core/model/Document.cpp +++ b/src/core/model/Document.cpp @@ -716,6 +716,20 @@ bool Document::hasChild(Handle s) const return false; } +void Document::setRoot(Handle rt){ + if(rt == nullptr || root == rt){ + return; + } + if(root != nullptr){ + root->setParent(nullptr); + } + root = acquire(rt); + if (rt->getParent() != this) { + rt->setParent(this); + } + invalidate(); +} + /* Type registrations */ namespace RttiTypes { const Rtti Document = RttiBuilder("Document") -- cgit v1.2.3