From 00f36d78e40c3c70e43cb495bf74a39fa4536ec3 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Sun, 8 Apr 2018 20:02:56 -0400 Subject: [PATCH] Update Page display when View removed. - if a View is removed from a Page, but not from the document, its graphic remains on the display. This change checks if graphic has an associated View on this Page. --- src/Mod/TechDraw/Gui/MDIViewPage.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Mod/TechDraw/Gui/MDIViewPage.cpp b/src/Mod/TechDraw/Gui/MDIViewPage.cpp index 6a5290d230..749349ad32 100644 --- a/src/Mod/TechDraw/Gui/MDIViewPage.cpp +++ b/src/Mod/TechDraw/Gui/MDIViewPage.cpp @@ -374,16 +374,8 @@ void MDIViewPage::updateDrawing(bool forceUpdate) { // get all the DrawViews for this page, including the second level ones // if we ever have collections of collections, we'll need to revisit this - std::vector pChildren = m_vpPage->getDrawPage()->Views.getValues(); - std::vector appendChildren; - for (auto& pc: pChildren) { - if(pc->getTypeId().isDerivedFrom(TechDraw::DrawViewCollection::getClassTypeId())) { - TechDraw::DrawViewCollection *collect = dynamic_cast(pc); - std::vector cChildren = collect->Views.getValues(); - appendChildren.insert(std::end(appendChildren), std::begin(cChildren), std::end(cChildren)); - } - } - pChildren.insert(std::end(pChildren),std::begin(appendChildren),std::end(appendChildren)); + DrawPage* thisPage = m_vpPage->getDrawPage(); + std::vector pChildren = thisPage->getAllViews(); // if dv doesn't have a graphic, make one for (auto& dv: pChildren) { @@ -396,13 +388,18 @@ void MDIViewPage::updateDrawing(bool forceUpdate) } } - // if qView doesn't have a Feature, delete it + // if qView doesn't have a Feature on this Page, delete it std::vector qvs = m_view->getViews(); App::Document* doc = getAppDocument(); for (auto& qv: qvs) { App::DocumentObject* obj = doc->getObject(qv->getViewName()); if (obj == nullptr) { m_view->removeQView(qv); + } else { + DrawPage* pp = qv->getViewObject()->findParentPage(); + if (thisPage != pp) { + m_view->removeQView(qv); + } } }