From 2a6bd73fc0e08d316115721ccb61a0a54bc907b0 Mon Sep 17 00:00:00 2001 From: wandererfan Date: Sat, 12 Nov 2022 08:57:37 -0500 Subject: [PATCH] [TD]apply review comments from @chennes - also delete empty execute method --- src/Mod/TechDraw/App/DrawSVGTemplate.cpp | 2 +- src/Mod/TechDraw/App/DrawTemplate.cpp | 19 ++----------------- src/Mod/TechDraw/App/DrawTemplate.h | 8 -------- 3 files changed, 3 insertions(+), 26 deletions(-) diff --git a/src/Mod/TechDraw/App/DrawSVGTemplate.cpp b/src/Mod/TechDraw/App/DrawSVGTemplate.cpp index 3a7b51286b..f05e847306 100644 --- a/src/Mod/TechDraw/App/DrawSVGTemplate.cpp +++ b/src/Mod/TechDraw/App/DrawSVGTemplate.cpp @@ -97,7 +97,7 @@ void DrawSVGTemplate::onChanged(const App::Property* prop) } //parse the Svg code, inserting current EditableTexts values, and return the result as a QString. -//While parsing, not the Orientation, Width and Height values in the Svg code. +//While parsing, note the Orientation, Width and Height values in the Svg code. QString DrawSVGTemplate::processTemplate() { // Base::Console().Message("DSVGT::processTemplate() - isRestoring: %d\n", isRestoring()); diff --git a/src/Mod/TechDraw/App/DrawTemplate.cpp b/src/Mod/TechDraw/App/DrawTemplate.cpp index 43d190496f..c8faadd5d7 100644 --- a/src/Mod/TechDraw/App/DrawTemplate.cpp +++ b/src/Mod/TechDraw/App/DrawTemplate.cpp @@ -80,23 +80,7 @@ double DrawTemplate::getHeight() const return Height.getValue(); } -App::DocumentObjectExecReturn *DrawTemplate::execute() -{ -// DrawPage *page = nullptr; -// std::vector parent = getInList(); -// for (std::vector::iterator it = parent.begin(); it != parent.end(); ++it) { -// if ((*it)->getTypeId().isDerivedFrom(DrawPage::getClassTypeId())) { -// page = dynamic_cast(*it); -// } -// } - -// if(page) { -// page->Template.touch(); -// } - - return App::DocumentObject::execute(); -} - +//find the (first) DrawPage which points to this template DrawPage* DrawTemplate::getParentPage() const { TechDraw::DrawPage* page(nullptr); @@ -104,6 +88,7 @@ DrawPage* DrawTemplate::getParentPage() const for (auto& obj : parents) { if (obj->getTypeId().isDerivedFrom(DrawPage::getClassTypeId())) { page = static_cast(obj); + break; } } return page; diff --git a/src/Mod/TechDraw/App/DrawTemplate.h b/src/Mod/TechDraw/App/DrawTemplate.h index f031c6987b..868385618a 100644 --- a/src/Mod/TechDraw/App/DrawTemplate.h +++ b/src/Mod/TechDraw/App/DrawTemplate.h @@ -50,7 +50,6 @@ public: App::PropertyMap EditableTexts; public: - /// Returns template width in mm virtual double getWidth() const; /// Returns template height in mm @@ -58,13 +57,6 @@ public: virtual DrawPage* getParentPage() const; - /** @name methods override Feature */ - //@{ - /// recalculate the Feature - App::DocumentObjectExecReturn *execute(void) override; - //@} - - /// returns the type name of the ViewProvider const char* getViewProviderName(void) const override{ return "TechDrawGui::ViewProviderTemplate";