From 11f5500716a84655ce230e1feea9fbab7c1f1872 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sun, 7 Jun 2020 13:34:32 +0200 Subject: [PATCH] PartDesign: closing task dialog when exiting edit mode for Primitives ===================================================================== fixes #4241 Problem: PartDesignGui::ViewProvider is responsible for closing the tasks for most of PD features when exiting edit mode (i.e. unsetEdit()). For primitives, PartDesignGui::ViewProviderPrimitive is responsible, and neither does it or relies on its parent VP to do it when calling unsetEdit(). Solution: Make PartDesignGui::ViewProviderPrimitive::unsetEdit() rely on parent PartDesignGui::ViewProvider to tidy up, including closing the task dialog. Reference: This is the default stack call when closing a document while a PD task using PartDesignGui::Viewprovider is active: --- src/Mod/PartDesign/Gui/ViewProviderPrimitive.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Mod/PartDesign/Gui/ViewProviderPrimitive.cpp b/src/Mod/PartDesign/Gui/ViewProviderPrimitive.cpp index 2a172bca44..117d24709e 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderPrimitive.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderPrimitive.cpp @@ -123,8 +123,12 @@ bool ViewProviderPrimitive::setEdit(int ModNum) void ViewProviderPrimitive::unsetEdit(int ModNum) { - Q_UNUSED(ModNum); setPreviewDisplayMode(false); + + // Rely on parent class to: + // restitute old workbench (set setEdit above) and close the dialog if exiting editing + PartDesignGui::ViewProvider::unsetEdit(ModNum); + } void ViewProviderPrimitive::updateData(const App::Property* p) {