Salome HOME
Issue #1834: Fix length of lines
[modules/shaper.git] / src / PartSet / PartSet_WidgetPoint2dDistance.cpp
index f3991587b375a6180473b803b6d5efe74d197e1b..2c7daebdedc25ba8f850d6e3ed8010bf3b012ddf 100644 (file)
@@ -58,6 +58,7 @@ bool PartSet_WidgetPoint2dDistance::resetCustom()
       // if the restored value should be hidden, aDone = true to set
       // reset state for the widget in the parent
       aDone = restoreCurentValue();
+      emit objectUpdated();
     }
     else
       aDone = ModuleBase_WidgetDoubleValue::resetCustom();
@@ -90,26 +91,7 @@ double PartSet_WidgetPoint2dDistance::computeValue(const std::shared_ptr<GeomAPI
   return theCurrentPnt->distance(theFirstPnt);
 }
 
-void PartSet_WidgetPoint2dDistance::activateCustom()
-{
-  ModuleBase_IViewer* aViewer = myWorkshop->viewer();
-  connect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)),
-          this, SLOT(onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*)));
-  connect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)), 
-          this, SLOT(onMouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)));
-}
-
-void PartSet_WidgetPoint2dDistance::deactivate()
-{
-  ModuleBase_ModelWidget::deactivate();
-  ModuleBase_IViewer* aViewer = myWorkshop->viewer();
-  disconnect(aViewer, SIGNAL(mouseMove(ModuleBase_IViewWindow*, QMouseEvent*)), 
-             this, SLOT(onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*)));
-  disconnect(aViewer, SIGNAL(mouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)), 
-             this, SLOT(onMouseRelease(ModuleBase_IViewWindow*, QMouseEvent*)));
-}
-
-void PartSet_WidgetPoint2dDistance::onMouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
+void PartSet_WidgetPoint2dDistance::mouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
 {
   // the contex menu release by the right button should not be processed by this widget
   if (theEvent->button() != Qt::LeftButton)
@@ -127,11 +109,11 @@ void PartSet_WidgetPoint2dDistance::onMouseRelease(ModuleBase_IViewWindow* theWn
   setPoint(feature(), aPnt);
 
   // if the validator of the control returns false, focus should not be switched
-  if (getError().isEmpty())
+  if (getError(false).isEmpty())
     emit focusOutWidget(this);
 }
 
-void PartSet_WidgetPoint2dDistance::onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
+void PartSet_WidgetPoint2dDistance::mouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
 {
   if (isEditingMode())
     return;