Salome HOME
Sources formated according to the codeing standards
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetDoubleValue.cpp
index f246713cd7d5e6d54482a6f0b27bf3a547a513fc..361c07cfc8da1153c14d45fa38f51deac4f99113 100644 (file)
 #define DBL_MAX 1.7976931348623158e+308 
 #endif
 
-
-ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, const Config_WidgetAPI* theData)
-  : ModuleBase_ModelWidget(theParent, theData)
+ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent,
+                                                           const Config_WidgetAPI* theData,
+                                                           const std::string& theParentId)
+    : ModuleBase_ModelWidget(theParent, theData, theParentId)
 {
   myContainer = new QWidget(theParent);
   QHBoxLayout* aControlLay = new QHBoxLayout(myContainer);
@@ -88,20 +89,20 @@ ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue()
 {
 }
 
-bool ModuleBase_WidgetDoubleValue::storeValue(ObjectPtr theObject) const
+bool ModuleBase_WidgetDoubleValue::storeValue() const
 {
-  DataPtr aData = theObject->data();
+  DataPtr aData = myFeature->data();
   AttributeDoublePtr aReal = aData->real(attributeID());
   if (aReal->value() != mySpinBox->value()) {
     aReal->setValue(mySpinBox->value());
-    Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
+    updateObject(myFeature);
   }
   return true;
 }
 
-bool ModuleBase_WidgetDoubleValue::restoreValue(ObjectPtr theObject)
+bool ModuleBase_WidgetDoubleValue::restoreValue()
 {
-  DataPtr aData = theObject->data();
+  DataPtr aData = myFeature->data();
   AttributeDoublePtr aRef = aData->real(attributeID());
 
   bool isBlocked = mySpinBox->blockSignals(true);
@@ -123,7 +124,7 @@ bool ModuleBase_WidgetDoubleValue::eventFilter(QObject *theObject, QEvent *theEv
 {
   if (theObject == mySpinBox) {
     if (theEvent->type() == QEvent::KeyRelease) {
-      QKeyEvent* aKeyEvent = (QKeyEvent*)theEvent;
+      QKeyEvent* aKeyEvent = (QKeyEvent*) theEvent;
       if (aKeyEvent && aKeyEvent->key() == Qt::Key_Return) {
         emit focusOutWidget(this);
       }