Salome HOME
Fix Warning in NewGeom_Module.cpp
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetExprEditor.cpp
index 2d0e841a4a3de3273b35f17512a77e490e618d32..431a387f8d69c83bae09a9b73db7db1ad61b6e77 100644 (file)
@@ -137,6 +137,7 @@ void ExpressionEditor::keyPressEvent(QKeyEvent* theEvent)
     switch (theEvent->key()) {
       case Qt::Key_Enter:
       case Qt::Key_Return:
+        emit keyReleased(theEvent);
         // do not react to the Enter key, the property panel processes it
         return;
       break;
@@ -211,15 +212,6 @@ void ExpressionEditor::paintEvent( QPaintEvent* theEvent )
   }
 }
 
-bool ExpressionEditor::focusNextPrevChild(bool theIsNext)
-{
-  if (myIsModified)
-    emit editingFinished();
-  emit valueStored();
-  emit focusNextPrev();
-  return QPlainTextEdit::focusNextPrevChild(theIsNext);
-}
-
 void ExpressionEditor::onTextChanged()
 {
   myIsModified = true;
@@ -249,15 +241,17 @@ ModuleBase_WidgetExprEditor::ModuleBase_WidgetExprEditor( QWidget* theParent,
   this->setLayout(aMainLay);
 
   connect(myEditor, SIGNAL(valueModified()), this, SIGNAL(valuesModified()));
-  //connect(myEditor, SIGNAL(editingFinished()), this, SLOT(onTextChanged()));
-  connect(myEditor, SIGNAL(valueStored()), this, SLOT(onTextChanged()));
-  connect(myEditor, SIGNAL(focusNextPrev()), this, SIGNAL(focusNextPrev()));
+  connect(myEditor, SIGNAL(keyReleased(QKeyEvent*)), this, SIGNAL(keyReleased(QKeyEvent*)));
 }
 
 ModuleBase_WidgetExprEditor::~ModuleBase_WidgetExprEditor()
 {
 }
 
+void ModuleBase_WidgetExprEditor::initializeValueByActivate()
+{
+}
+
 bool ModuleBase_WidgetExprEditor::storeValueCustom() const
 {
   // A rare case when plugin was not loaded. 
@@ -265,6 +259,7 @@ bool ModuleBase_WidgetExprEditor::storeValueCustom() const
     return false;
   DataPtr aData = myFeature->data();
   AttributeStringPtr aStringAttr = aData->string(attributeID());
+
   QString aWidgetValue = myEditor->toPlainText();
   aStringAttr->setValue(aWidgetValue.toStdString());
   updateObject(myFeature);
@@ -319,10 +314,11 @@ QList<QWidget*> ModuleBase_WidgetExprEditor::getControls() const
 
 bool ModuleBase_WidgetExprEditor::processEnter()
 {
-  bool isModified = myEditor->isModified();
+  //bool isModified = myEditor->isModified();
+  bool isModified = getValueState() == ModifiedInPP;
   if (isModified) {
     emit valuesChanged();
-    myEditor->clearModified();
+    //myEditor->clearModified();
     myEditor->selectAll();
   }
   return isModified;