Salome HOME
PLaneGCSSolver: It is not necessary to adjust Angle constraint (issue #1536)
[modules/shaper.git] / src / PartSet / PartSet_WidgetPoint2dDistance.cpp
index 9e92051b7964bace54cb3943faae3cf5215c1b58..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>
 
 PartSet_WidgetPoint2dDistance::PartSet_WidgetPoint2dDistance(QWidget* theParent,
                                                              ModuleBase_IWorkshop* theWorkshop,
-                                                             const Config_WidgetAPI* theData,
-                                                             const std::string& theParentId)
-: ModuleBase_WidgetDoubleValue(theParent, theData, theParentId), myWorkshop(theWorkshop),
+                                                             const Config_WidgetAPI* theData)
+: ModuleBase_WidgetDoubleValue(theParent, theData), myWorkshop(theWorkshop),
   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;
@@ -51,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();
@@ -120,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);
 }