Salome HOME
Apply modifications in the editors by Enter/Tab event only.
[modules/shaper.git] / src / XGUI / XGUI_OperationMgr.cpp
index 92db976896a2a3391855ef5a4c023c2066166f4f..a64083ae54003f67e23c21b77b8776bec4963494 100644 (file)
@@ -498,16 +498,34 @@ void XGUI_OperationMgr::onOperationStopped()
   }
 }
 
+#include <ModuleBase_IPropertyPanel.h>
+#include <ModuleBase_ModelWidget.h>
 bool XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent)
 {
+  qDebug("XGUI_OperationMgr::onKeyReleased");
+  QObject* aSender = sender();
+
   // Let the manager decide what to do with the given key combination.
   ModuleBase_Operation* anOperation = currentOperation();
   bool isAccepted = true;
   switch (theEvent->key()) {
     case Qt::Key_Return:
     case Qt::Key_Enter: {
-      emit keyEnterReleased();
-      commitOperation();
+      ModuleBase_Operation* aOperation = currentOperation();
+      ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
+      ModuleBase_ModelWidget* aActiveWgt = aPanel->activeWidget();
+      if (aActiveWgt && !aActiveWgt->isEventProcessed(theEvent)) {
+        qDebug("XGUI_OperationMgr::onKeyReleased accept Enter");
+        ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(currentOperation());
+        if (!aFOperation || myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) {
+          emit keyEnterReleased();
+          commitOperation();
+        }
+        else
+          isAccepted = false;
+      }
+      //else
+      //  isAccepted = false;
     }
     case Qt::Key_N:
     case Qt::Key_P: {