Salome HOME
Issue #1062: Parameter value is thrown down in the point selector control
[modules/shaper.git] / src / XGUI / XGUI_OperationMgr.cpp
index ace0a27492e4823377b3106e4b3a30a25f6c489e..d441258e806a1f7e0a7bea31c2c309d129dca3c6 100644 (file)
@@ -136,9 +136,10 @@ bool XGUI_OperationMgr::startOperation(ModuleBase_Operation* theOperation)
     connect(aFOperation, SIGNAL(activatedByPreselection()),
             SIGNAL(operationActivatedByPreselection()));
 
-  theOperation->start();
-  onValidateOperation();
-  return true;
+  bool isStarted = theOperation->start();
+  if (isStarted)
+    onValidateOperation();
+  return isStarted;
 }
 
 bool XGUI_OperationMgr::abortAllOperations()
@@ -198,8 +199,18 @@ void XGUI_OperationMgr::onValidateOperation()
     return;
   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
                                                                           (currentOperation());
-  if(aFOperation && aFOperation->feature().get())
-    setApplyEnabled(myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty());
+  if(aFOperation && aFOperation->feature().get()) {
+    QString anError = myWorkshop->module()->getFeatureError(aFOperation->feature());
+    if (anError.isEmpty()) {
+      ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel();
+      if (aPanel) {
+        ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
+        if (anActiveWidget)
+          anError = myWorkshop->module()->getWidgetError(anActiveWidget);
+      }
+    }
+    setApplyEnabled(anError.isEmpty());
+  }
 }
 
 void XGUI_OperationMgr::setApplyEnabled(const bool theEnabled)
@@ -294,7 +305,7 @@ bool XGUI_OperationMgr::isGrantedOperation(const QString& theId)
   QListIterator<ModuleBase_Operation*> anIt(myOperations);
   anIt.toBack();
   ModuleBase_Operation* aPreviousOperation = 0;
-  while (anIt.hasPrevious()) {
+  while (anIt.hasPrevious() && !isGranted) {
     ModuleBase_Operation* anOp = anIt.previous();
     if (anOp)
       isGranted = anOp->isGranted(theId);
@@ -541,7 +552,7 @@ bool XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent)
       if (!aActiveWgt || !aActiveWgt->processEnter()) {
         if (!myWorkshop->module()->processEnter(aActiveWgt ? aActiveWgt->attributeID() : "")) {
           ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(currentOperation());
-          if (!aFOperation || myWorkshop->module()->getFeatureError(aFOperation->feature(), false).isEmpty()) {
+          if (!aFOperation || myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) {
             emit keyEnterReleased();
             commitOperation();
           }