]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModuleBase/ModuleBase_Operation.cpp
Salome HOME
Preselection realization for multi-selector widget to accept some selection values.
[modules/shaper.git] / src / ModuleBase / ModuleBase_Operation.cpp
index ff2780957fc336c22171175d85433ee26ea824c0..b934df13061c2bd6e6d74c9d1465c85e3ca809a2 100644 (file)
@@ -199,9 +199,7 @@ bool ModuleBase_Operation::commit()
 
 void ModuleBase_Operation::setRunning(bool theState)
 {
-  if (!theState) {
-    abort();
-  }
+  emit triggered(theState);
 }
 
 void ModuleBase_Operation::activateByPreselection()
@@ -218,18 +216,15 @@ void ModuleBase_Operation::activateByPreselection()
   
   ModuleBase_ModelWidget* aWgt, *aFilledWgt = 0;
   QList<ModuleBase_ModelWidget*>::const_iterator aWIt;
-  QList<ModuleBase_ViewerPrs>::const_iterator aPIt;
   bool isSet = false;
-  for (aWIt = aWidgets.constBegin(), aPIt = myPreSelection.constBegin();
-       (aWIt != aWidgets.constEnd()) && (aPIt != myPreSelection.constEnd());
-       ++aWIt) {
+  // 1. apply the selection to controls
+  int aCurrentPosition = 0;
+  for (aWIt = aWidgets.constBegin(); aWIt != aWidgets.constEnd(); ++aWIt) {
     aWgt = (*aWIt);
-    ModuleBase_ViewerPrs aValue = (*aPIt);
     if (!aWgt->canSetValue())
       continue;
 
-    ++aPIt;
-    if (!aWgt->setSelection(aValue)) {
+    if (!aWgt->setSelection(myPreSelection, aCurrentPosition/*aValue*/)) {
       isSet = false;
       break;
     } else {
@@ -237,7 +232,15 @@ void ModuleBase_Operation::activateByPreselection()
       aFilledWgt = aWgt;
     }
   }
+  // 2. ignore not obligatory widgets
+  /*for (; aWIt != aWidgets.constEnd(); ++aWIt) {
+    aWgt = (*aWIt);
+    if (aWgt && aWgt->isObligatory())
+      continue;
+    aFilledWgt = aWgt;
+  }*/
 
+  // 3. activate the next obligatory widget
   myPropertyPanel->activateNextWidget(aFilledWgt);
   if (aFilledWgt)
     emit activatedByPreselection();