Salome HOME
PLaneGCSSolver: It is not necessary to adjust Angle constraint (issue #1536)
[modules/shaper.git] / src / PartSet / PartSet_WidgetPoint2dDistance.cpp
index ed8165c23ab76da3c83746361a856b120b2a9348..427efc273fe8dd552c6718d67ffc9d69317a31ed 100644 (file)
@@ -16,6 +16,7 @@
 #include <ModuleBase_IViewWindow.h>
 #include <ModuleBase_IViewer.h>
 #include <ModuleBase_Tools.h>
+#include <ModuleBase_WidgetValidator.h>
 
 #include <GeomAPI_Pnt2d.h>
 #include <Config_WidgetAPI.h>
@@ -33,12 +34,19 @@ PartSet_WidgetPoint2dDistance::PartSet_WidgetPoint2dDistance(QWidget* theParent,
   myValueIsCashed(false), myIsFeatureVisibleInCash(true), myValueInCash(0)
 {
   myFirstPntName = theData->getProperty("first_point");
+  myWidgetValidator = new ModuleBase_WidgetValidator(this, myWorkshop);
 }
 
 PartSet_WidgetPoint2dDistance::~PartSet_WidgetPoint2dDistance()
 {
 }
 
+bool PartSet_WidgetPoint2dDistance::isValidSelectionCustom(
+                                      const std::shared_ptr<ModuleBase_ViewerPrs>& theValue)
+{
+  return false;
+}
+
 bool PartSet_WidgetPoint2dDistance::resetCustom()
 {
   bool aDone = false;
@@ -50,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();
@@ -119,7 +128,7 @@ 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);
 }