Salome HOME
Fix compilation on Linux
[modules/shaper.git] / src / ModuleBase / ModuleBase_OperationFeature.cpp
index c460480fdaabbab81ad64db869900ee7c9f81c9b..2508ac0c198030e91bc9ae864a2daae3f51ea2e7 100755 (executable)
@@ -172,8 +172,10 @@ FeaturePtr ModuleBase_OperationFeature::createFeature(const bool theFlushMessage
      }*/
   }
 
-  if (theFlushMessage)
+  if (theFlushMessage) {
     Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
+    Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
+  }
   return myFeature;
 }
 
@@ -365,7 +367,7 @@ ModuleBase_ModelWidget* ModuleBase_OperationFeature::activateByPreselection(
         // 1. apply the selection to controls
         for (aWIt = aWidgets.constBegin(); aWIt != aWidgets.constEnd(); ++aWIt) {
           aWgt = (*aWIt);
-          if (!aWgt->canSetValue())
+          if (!aWgt->canAcceptFocus())
             continue;
           aPropertyPanel->setPreselectionWidget(aWgt);
           if (!aWgt->setSelection(myPreSelection, true)) {
@@ -381,7 +383,7 @@ ModuleBase_ModelWidget* ModuleBase_OperationFeature::activateByPreselection(
       // in order to redisplay object in the viewer, the update/redisplay signals should be flushed
       // it is better to perform it not in setSelection of each widget, but do it here,
       // after the preselection is processed
-      ModuleBase_ModelWidget::updateObject(myFeature);
+      ModuleBase_Tools::flushUpdated(myFeature);
     }
   }
   clearPreselection();
@@ -412,13 +414,11 @@ FeaturePtr ModuleBase_OperationFeature::previousCurrentFeature()
 void ModuleBase_OperationFeature::initSelection(ModuleBase_ISelection* theSelection,
                                          ModuleBase_IViewer* theViewer)
 {
-  clearPreselection();
-
-  QList<ModuleBase_ViewerPrs> aPreSelected;
+  QList<ModuleBase_ViewerPrsPtr> aPreSelected;
   // Check that the selected result are not results of operation feature
   FeaturePtr aFeature = feature();
   if (aFeature) {
-    QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected(ModuleBase_ISelection::AllControls);
+    QList<ModuleBase_ViewerPrsPtr> aSelected = theSelection->getSelected(ModuleBase_ISelection::AllControls);
 
     std::list<ResultPtr> aResults = aFeature->results();
     QObjectPtrList aResList;
@@ -426,14 +426,20 @@ void ModuleBase_OperationFeature::initSelection(ModuleBase_ISelection* theSelect
     for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt)
       aResList.append(*aIt);
 
-    foreach (ModuleBase_ViewerPrs aPrs, aSelected) {
-      if ((!aResList.contains(aPrs.object())) && (aPrs.object() != aFeature))
+    foreach (ModuleBase_ViewerPrsPtr aPrs, aSelected) {
+      if ((!aResList.contains(aPrs->object())) && (aPrs->object() != aFeature))
         aPreSelected.append(aPrs);
     }
   } else
     aPreSelected = theSelection->getSelected(ModuleBase_ISelection::AllControls);
 
-  myPreSelection = aPreSelected;
+  setPreselection(aPreSelected);
+}
+
+void ModuleBase_OperationFeature::setPreselection(const QList<ModuleBase_ViewerPrsPtr>& theValues)
+{
+  clearPreselection();
+  myPreSelection = theValues;
 }
 
 void ModuleBase_OperationFeature::clearPreselection()