From 9239815477ef436c7c321bbf59fa6fa1a4ff6b0f Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 8 Dec 2014 10:08:16 +0300 Subject: [PATCH] A modification to commit the Lenght and the Radius constraints by the preselection. The distance still does not work because it uses the local points selection. --- src/ModuleBase/ModuleBase_ModelWidget.h | 4 ++++ src/ModuleBase/ModuleBase_Operation.cpp | 6 +++++- src/ModuleBase/ModuleBase_WidgetLabel.h | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index 9f55dab1e..c8a91fb93 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -51,6 +51,10 @@ Q_OBJECT /// Defines if it is supposed that the widget should interact with the viewer. virtual bool isViewerSelector() { return false; } + /// Defines if it is supported to set the value in this widget + /// By default it returns true + virtual bool canSetValue() const { return true; }; + /// Set the given wrapped value to the current widget /// This value should be processed in the widget according to the needs /// \param theValue the wrapped widget value diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index 5ee3daa6e..eca9c1c2a 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -247,9 +247,13 @@ bool ModuleBase_Operation::activateByPreselection() bool isSet = false; for (aWIt = aWidgets.constBegin(), aPIt = myPreSelection.constBegin(); (aWIt != aWidgets.constEnd()) && (aPIt != myPreSelection.constEnd()); - ++aWIt, ++aPIt) { + ++aWIt) { aWgt = (*aWIt); ModuleBase_WidgetValueFeature* aValue = (*aPIt); + if (!aWgt->canSetValue()) + continue; + + ++aPIt; if (!aWgt->setValue(aValue)) { isSet = false; break; diff --git a/src/ModuleBase/ModuleBase_WidgetLabel.h b/src/ModuleBase/ModuleBase_WidgetLabel.h index 81c7be592..7935316da 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabel.h +++ b/src/ModuleBase/ModuleBase_WidgetLabel.h @@ -19,6 +19,10 @@ Q_OBJECT virtual ~ModuleBase_WidgetLabel(); + /// Defines if it is supported to set the value in this widget + /// It returns false because this is an info widget + virtual bool canSetValue() const { return false; }; + virtual bool storeValue() const { return true; -- 2.39.2