Salome HOME
Constriction type for all sketch entities
[modules/shaper.git] / src / PartSet / PartSet_WidgetPoint2dDistance.cpp
index be108103444444fb9defbfc239b8f925efcddc31..14ac4592178c9bb0adae1f0cc05e963d1551ec2d 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <ModuleBase_DoubleSpinBox.h>
 #include <ModuleBase_IViewWindow.h>
+#include <ModuleBase_Tools.h>
 
 #include <XGUI_ViewerProxy.h>
 #include <XGUI_Workshop.h>
@@ -40,6 +41,14 @@ PartSet_WidgetPoint2dDistance::~PartSet_WidgetPoint2dDistance()
 {
 }
 
+void PartSet_WidgetPoint2dDistance::reset()
+{
+  bool isOk;
+  double aDefValue = QString::fromStdString(getDefaultValue()).toDouble(&isOk);
+
+  ModuleBase_Tools::setSpinValue(mySpinBox, isOk ? aDefValue : 0.0);
+}
+
 void PartSet_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature,
                                              const std::shared_ptr<GeomAPI_Pnt2d>& thePnt)
 {
@@ -53,10 +62,9 @@ void PartSet_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature,
   AttributeDoublePtr aReal = aData->real(attributeID());
   if (aReal && (aReal->value() != aRadius)) {
     aReal->setValue(aRadius);
-    mySpinBox->blockSignals(true);
-    mySpinBox->setValue(aRadius);
-    mySpinBox->blockSignals(false);
-    emit valuesChanged();
+    
+    ModuleBase_Tools::setSpinValue(mySpinBox, aRadius);
+    storeValue();
   }
 }