]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
Salome HOME
Preselection realization for multi-selector widget to accept some selection values.
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetMultiSelector.cpp
index 57e2ce9492683be78fd14faa38f6fece0beee4ba..c2e3138a534a37470800e452fb16f8edb031bdec 100644 (file)
@@ -194,6 +194,35 @@ void ModuleBase_WidgetMultiSelector::restoreAttributeValue(bool/* theValid*/)
   }
 }
 
+//********************************************************************
+bool ModuleBase_WidgetMultiSelector::setSelection(const QList<ModuleBase_ViewerPrs>& theValues,
+                                                  int& thePosition)
+{
+  if (thePosition < 0)
+    return false;
+
+  QList<ModuleBase_ViewerPrs>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
+  bool isDone = false;
+  for (int i = thePosition; i < theValues.size(); i++) {
+    ModuleBase_ViewerPrs aValue = theValues[i];
+    thePosition++;
+    bool aProcessed = false;
+    if (isValidSelection(aValue)) {
+      aProcessed = setSelectionCustom(aValue);
+    }
+    // if there is at least one set, the result is true
+    isDone = isDone || aProcessed;
+    // when an object, which do not satisfy the validating process, stop set selection
+    if (!aProcessed)
+      break;
+  }
+  if (isDone) {
+    updateObject(myFeature);
+    emit valuesChanged();
+  }
+  return isDone;
+}
+
 //********************************************************************
 bool ModuleBase_WidgetMultiSelector::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
 {