Salome HOME
Merge branch 'Dev_1.5.0' of salome:modules/shaper into Dev_1.5.0
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetDoubleValue.cpp
index 5f9dc8a5b6d3cbf350ede6b4e0e9bfe43b027e87..a43f02cb6b2b6e43db5d314a612e487f082e453c 100644 (file)
@@ -31,8 +31,6 @@
 #include <iostream>
 #endif
 
-#define APPLY_BY_ENTER_OR_TAB
-
 ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent,
                                                            const Config_WidgetAPI* theData,
                                                            const std::string& theParentId)
@@ -88,21 +86,14 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent,
   myLabel->setToolTip(aTTip);
 
   aControlLay->addRow(myLabel, mySpinBox);
-#ifdef APPLY_BY_ENTER_OR_TAB
-  // Apply widget value change by enter/tab event.
-  connect(mySpinBox, SIGNAL(editingFinished()), this, SIGNAL(valuesChanged()));
   connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesModified()));
-
-#else
-  connect(mySpinBox, SIGNAL(valueChanged(const QString&)), this, SIGNAL(valuesChanged()));
-#endif
 }
 
 ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue()
 {
 }
 
-bool ModuleBase_WidgetDoubleValue::reset()
+bool ModuleBase_WidgetDoubleValue::resetCustom()
 {
   bool aDone = false;
   if (!isUseReset() || isComputedDefault() || mySpinBox->hasVariable()) {
@@ -153,6 +144,11 @@ bool ModuleBase_WidgetDoubleValue::restoreValueCustom()
   return true;
 }
 
+void ModuleBase_WidgetDoubleValue::selectContent()
+{
+  mySpinBox->selectAll();
+}
+
 QList<QWidget*> ModuleBase_WidgetDoubleValue::getControls() const
 {
   QList<QWidget*> aList;
@@ -160,7 +156,13 @@ QList<QWidget*> ModuleBase_WidgetDoubleValue::getControls() const
   return aList;
 }
 
-bool ModuleBase_WidgetDoubleValue::isEventProcessed(QKeyEvent* theEvent)
+bool ModuleBase_WidgetDoubleValue::processEnter()
 {
-  return mySpinBox->isEventProcessed(theEvent);
+  bool isModified = mySpinBox->isModified();
+  if (isModified) {
+    emit valuesChanged();
+    mySpinBox->clearModified();
+    mySpinBox->selectAll();
+  }
+  return isModified;
 }