diff --git a/src/Mod/PartDesign/Gui/ViewProvider.cpp b/src/Mod/PartDesign/Gui/ViewProvider.cpp index 6e1805e12a..0e0e04af11 100644 --- a/src/Mod/PartDesign/Gui/ViewProvider.cpp +++ b/src/Mod/PartDesign/Gui/ViewProvider.cpp @@ -249,6 +249,15 @@ void ViewProvider::updatePreview() } } +void ViewProvider::makeChildrenVisible() +{ + for (const auto child : claimChildren()) { + if (auto vp = Gui::Application::Instance->getViewProvider(child)) { + vp->show(); + } + } +} + void ViewProvider::onChanged(const App::Property* prop) { //if the object is inside of a body we make sure it is the only visible one on activation @@ -340,6 +349,8 @@ bool ViewProvider::onDelete(const std::vector&) FCMD_OBJ_CMD(body, "removeObject(" << Gui::Command::getObjectCmd(feature) << ')'); } + makeChildrenVisible(); + return true; } diff --git a/src/Mod/PartDesign/Gui/ViewProvider.h b/src/Mod/PartDesign/Gui/ViewProvider.h index c09c30978b..9b5f361940 100644 --- a/src/Mod/PartDesign/Gui/ViewProvider.h +++ b/src/Mod/PartDesign/Gui/ViewProvider.h @@ -98,6 +98,7 @@ protected: void attachPreview() override; void updatePreview() override; + virtual void makeChildrenVisible(); bool onDelete(const std::vector &) override; /** diff --git a/src/Mod/PartDesign/Gui/ViewProviderHelix.cpp b/src/Mod/PartDesign/Gui/ViewProviderHelix.cpp index 53e6da3382..02590eade3 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderHelix.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderHelix.cpp @@ -78,18 +78,3 @@ std::vector ViewProviderHelix::claimChildren() const { return temp; } -bool ViewProviderHelix::onDelete(const std::vector &s) { - PartDesign::ProfileBased* feature = getObject(); - - // get the Sketch - Sketcher::SketchObject *pcSketch = nullptr; - if (feature->Profile.getValue()) - pcSketch = static_cast(feature->Profile.getValue()); - - // if abort command deleted the object the sketch is visible again - if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch)) - Gui::Application::Instance->getViewProvider(pcSketch)->show(); - - return ViewProvider::onDelete(s); -} - diff --git a/src/Mod/PartDesign/Gui/ViewProviderHelix.h b/src/Mod/PartDesign/Gui/ViewProviderHelix.h index 979ebaaf6c..921c6aac6a 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderHelix.h +++ b/src/Mod/PartDesign/Gui/ViewProviderHelix.h @@ -44,8 +44,6 @@ public: /// grouping handling std::vector claimChildren() const override; - bool onDelete(const std::vector &) override; - protected: QIcon getIcon() const override; diff --git a/src/Mod/PartDesign/Gui/ViewProviderHole.cpp b/src/Mod/PartDesign/Gui/ViewProviderHole.cpp index 767d328b01..8cb9ffd8df 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderHole.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderHole.cpp @@ -63,23 +63,6 @@ void ViewProviderHole::setupContextMenu(QMenu* menu, QObject* receiver, const ch PartDesignGui::ViewProvider::setupContextMenu(menu, receiver, member); } -bool ViewProviderHole::onDelete(const std::vector& s) -{ - // get the Sketch - PartDesign::Hole* pcHole = getObject(); - Sketcher::SketchObject* pcSketch = nullptr; - if (pcHole->Profile.getValue()) { - pcSketch = static_cast(pcHole->Profile.getValue()); - } - - // if abort command deleted the object the sketch is visible again - if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch)) { - Gui::Application::Instance->getViewProvider(pcSketch)->show(); - } - - return ViewProvider::onDelete(s); -} - TaskDlgFeatureParameters* ViewProviderHole::getEditDialog() { return new TaskDlgHoleParameters(this); diff --git a/src/Mod/PartDesign/Gui/ViewProviderHole.h b/src/Mod/PartDesign/Gui/ViewProviderHole.h index a586f0e15d..917711feef 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderHole.h +++ b/src/Mod/PartDesign/Gui/ViewProviderHole.h @@ -42,7 +42,6 @@ public: /// grouping handling std::vector claimChildren()const override; void setupContextMenu(QMenu *menu, QObject *receiver, const char *member) override; - bool onDelete(const std::vector &s) override; protected: TaskDlgFeatureParameters* getEditDialog() override; diff --git a/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp b/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp index c072846781..cf2d5ea1b0 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderLoft.cpp @@ -71,23 +71,6 @@ TaskDlgFeatureParameters* ViewProviderLoft::getEditDialog() { return new TaskDlgLoftParameters(this); } -bool ViewProviderLoft::onDelete(const std::vector & /*s*/) -{/* - PartDesign::Loft* pcLoft = getObject(); - - // get the Sketch - Sketcher::SketchObject *pcSketch = 0; - if (pcLoft->Sketch.getValue()) - pcSketch = static_cast(pcLoft->Sketch.getValue()); - - // if abort command deleted the object the sketch is visible again - if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch)) - Gui::Application::Instance->getViewProvider(pcSketch)->show(); - - return ViewProvider::onDelete(s);*/ - return true; -} - void ViewProviderLoft::highlightProfile(bool on) { PartDesign::Loft* pcLoft = getObject(); diff --git a/src/Mod/PartDesign/Gui/ViewProviderLoft.h b/src/Mod/PartDesign/Gui/ViewProviderLoft.h index 721c5bc605..ea0224daeb 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderLoft.h +++ b/src/Mod/PartDesign/Gui/ViewProviderLoft.h @@ -48,7 +48,6 @@ public: std::vector claimChildren() const override; void setupContextMenu(QMenu*, QObject*, const char*) override; - bool onDelete(const std::vector &) override; void highlightProfile(bool on); void highlightSection(bool on); void highlightReferences(Reference mode, bool on); diff --git a/src/Mod/PartDesign/Gui/ViewProviderPipe.cpp b/src/Mod/PartDesign/Gui/ViewProviderPipe.cpp index 7c4fc665e1..e2d7bbb1f4 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderPipe.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderPipe.cpp @@ -79,24 +79,6 @@ TaskDlgFeatureParameters* ViewProviderPipe::getEditDialog() { return new TaskDlgPipeParameters(this, false); } -bool ViewProviderPipe::onDelete(const std::vector &s) -{/* - PartDesign::Pipe* pcPipe = getObject(); - - // get the Sketch - Sketcher::SketchObject *pcSketch = 0; - if (pcPipe->Sketch.getValue()) - pcSketch = static_cast(pcPipe->Sketch.getValue()); - - // if abort command deleted the object the sketch is visible again - if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch)) - Gui::Application::Instance->getViewProvider(pcSketch)->show(); -*/ - return ViewProvider::onDelete(s); -} - - - void ViewProviderPipe::highlightReferences(ViewProviderPipe::Reference mode, bool on) { PartDesign::Pipe* pcPipe = getObject(); diff --git a/src/Mod/PartDesign/Gui/ViewProviderPipe.h b/src/Mod/PartDesign/Gui/ViewProviderPipe.h index d8650b3d0a..6a262d1c48 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderPipe.h +++ b/src/Mod/PartDesign/Gui/ViewProviderPipe.h @@ -49,7 +49,6 @@ public: std::vector claimChildren()const override; void setupContextMenu(QMenu*, QObject*, const char*) override; - bool onDelete(const std::vector &) override; void highlightReferences(Reference mode, bool on); protected: diff --git a/src/Mod/PartDesign/Gui/ViewProviderSketchBased.cpp b/src/Mod/PartDesign/Gui/ViewProviderSketchBased.cpp index 1f783c5ac6..44587b242d 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderSketchBased.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderSketchBased.cpp @@ -36,7 +36,6 @@ PROPERTY_SOURCE(PartDesignGui::ViewProviderSketchBased, PartDesignGui::ViewProvi ViewProviderSketchBased::ViewProviderSketchBased() = default; - ViewProviderSketchBased::~ViewProviderSketchBased() = default; @@ -48,20 +47,3 @@ std::vector ViewProviderSketchBased::claimChildren() const return temp; } - - -bool ViewProviderSketchBased::onDelete(const std::vector &s) { - PartDesign::ProfileBased* feature = getObject(); - - // get the Sketch - Sketcher::SketchObject *pcSketch = nullptr; - if (feature->Profile.getValue()) - pcSketch = static_cast(feature->Profile.getValue()); - - // if abort command deleted the object the sketch is visible again - if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch)) - Gui::Application::Instance->getViewProvider(pcSketch)->show(); - - return ViewProvider::onDelete(s); -} - diff --git a/src/Mod/PartDesign/Gui/ViewProviderSketchBased.h b/src/Mod/PartDesign/Gui/ViewProviderSketchBased.h index d911a00301..46dc93f736 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderSketchBased.h +++ b/src/Mod/PartDesign/Gui/ViewProviderSketchBased.h @@ -43,8 +43,6 @@ public: /// grouping handling std::vector claimChildren() const override; - bool onDelete(const std::vector &) override; - }; } /* PartDesignGui */