]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2107 impossible to select segment for trim
authornds <nds@opencascade.com>
Thu, 6 Apr 2017 07:50:51 +0000 (10:50 +0300)
committernds <nds@opencascade.com>
Thu, 6 Apr 2017 07:50:51 +0000 (10:50 +0300)
src/PartSet/PartSet_WidgetFeaturePointSelector.cpp

index 663bc658b568bdf7813b23abd027ff5f46aebdc6..f68e580d9713841684332f00b948fbbfe3b4c901 100644 (file)
@@ -132,13 +132,18 @@ void PartSet_WidgetFeaturePointSelector::mouseReleased(ModuleBase_IViewWindow* t
   if (theEvent->button() != Qt::LeftButton)
     return;
 
+  std::shared_ptr<ModelAPI_AttributeReference> aRefPreviewAttr =
+                          std::dynamic_pointer_cast<ModelAPI_AttributeReference>(
+                          feature()->data()->attribute(SketchPlugin_Trim::PREVIEW_OBJECT()));
+  ObjectPtr aPreviewObject = aRefPreviewAttr->value();
+  // do not move focus from the current widget if the object is not highlighted/selected
+  if (!aPreviewObject.get())
+    return;
+
   // set parameters of preview into parameters of selection in the feature
   std::shared_ptr<ModelAPI_AttributeReference> aRefSelectedAttr =
                           std::dynamic_pointer_cast<ModelAPI_AttributeReference>(
                           feature()->data()->attribute(SketchPlugin_Trim::SELECTED_OBJECT()));
-  std::shared_ptr<ModelAPI_AttributeReference> aRefPreviewAttr =
-                          std::dynamic_pointer_cast<ModelAPI_AttributeReference>(
-                          feature()->data()->attribute(SketchPlugin_Trim::PREVIEW_OBJECT()));
   aRefSelectedAttr->setValue(aRefPreviewAttr->value());
 
   std::shared_ptr<GeomDataAPI_Point2D> aPointSelectedAttr =
@@ -167,9 +172,6 @@ bool PartSet_WidgetFeaturePointSelector::fillFeature(
   if (theSelectedPrs.get() && theSelectedPrs->object().get())
     anObject = theSelectedPrs->object();
 
-  if (!anObject.get())
-    return aFilled;
-
   std::shared_ptr<ModelAPI_AttributeReference> aRef =
                           std::dynamic_pointer_cast<ModelAPI_AttributeReference>(
                           feature()->data()->attribute(SketchPlugin_Trim::PREVIEW_OBJECT()));