From 23f7d231d3d75b641a76554f166387b51b853bae Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 5 Mar 2015 14:39:53 +0300 Subject: [PATCH] Construction elements are auxiliary entities: The regression: contour is not closed. We need to check whether there is at least one obligatory left widgets. --- src/ModuleBase/ModuleBase_ModelWidget.h | 4 ++++ src/PartSet/PartSet_Module.cpp | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index 80b1773a3..87112716e 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -60,6 +60,10 @@ Q_OBJECT /// \return the boolean result std::string getDefaultValue() const { return myDefaultValue; } + /// Returns true, if the obligatory value of the widget is not defined in the XML or has true value + /// \return the boolean result + bool isObligatory() const { return myIsObligatory; } + /// Defines if it is supposed that the widget should interact with the viewer. virtual bool isViewerSelector() { return false; } diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 39520d8af..6758f5722 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -431,10 +431,19 @@ void PartSet_Module::onVertexSelected() if (aOperation->id().toStdString() == SketchPlugin_Line::ID()) { /// If last line finished on vertex the lines creation sequence has to be break ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); + ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget(); const QList& aWidgets = aPanel->modelWidgets(); - if (aWidgets.last() == aPanel->activeWidget()) { - myRestartingMode = RM_Forbided; + QList::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end(); + bool aFoundWidget = false; + bool aFoundNonObligatory = false; + for (; anIt != aLast && !aFoundNonObligatory; anIt++) { + aFoundWidget = aFoundWidget || *anIt == anActiveWidget; + if (!aFoundWidget) + continue; + aFoundNonObligatory = !(*anIt)->isObligatory(); } + if (!aFoundNonObligatory) + myRestartingMode = RM_Forbided; } } -- 2.39.2