Salome HOME
SALOME mode correction for dimension constraints editor.
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetLineEdit.cpp
index 273cc902016246860653d4168e7fa0b56e0fc197..7f7e187b8319149030c1d77e65de0b407dfec026 100644 (file)
 #include <memory>
 #include <string>
 
+/**
+* Customization of Line edit control
+*/
 class CustomLineEdit : public QLineEdit
 {
 public:
+  /// Constructor
+  /// \param theParent a parent widget
+  /// \param thePlaceHolder a string which is shown when text is empty
   CustomLineEdit( QWidget* theParent, const QString& thePlaceHolder )
     : QLineEdit( theParent ), myPlaceHolder( thePlaceHolder )
   {
@@ -40,6 +46,8 @@ public:
   {
   }
 
+  /// Redefiniotion of virtual method
+  /// \param theEvent a paint event
   virtual void paintEvent( QPaintEvent* theEvent )
   {
     QLineEdit::paintEvent( theEvent );
@@ -91,7 +99,7 @@ ModuleBase_WidgetLineEdit::ModuleBase_WidgetLineEdit(QWidget* theParent,
   aMainLay->addRow(aLabel, myLineEdit);
   this->setLayout(aMainLay);
 
-  connect(myLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged()));
+  connect(myLineEdit, SIGNAL(textChanged(const QString&)), this, SIGNAL(valuesModified()));
 }
 
 ModuleBase_WidgetLineEdit::~ModuleBase_WidgetLineEdit()
@@ -133,7 +141,12 @@ QList<QWidget*> ModuleBase_WidgetLineEdit::getControls() const
   return result;
 }
 
-void ModuleBase_WidgetLineEdit::onTextChanged()
+bool ModuleBase_WidgetLineEdit::processEnter()
 {
-  storeValue();
+  bool isModified = getValueState() == ModifiedInPP;
+  if (isModified) {
+    emit valuesChanged();
+    myLineEdit->selectAll();
+  }
+  return isModified;
 }