]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp
Salome HOME
refs #80 - Sketch base GUI: create/draw point, circle and arc
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetDoubleValue.cpp
index d65091fd1a321cc2e97e3257a404baf660b20152..6ec34c3cae73dbf2fe57d8da3e0e2f7506a0f80b 100644 (file)
@@ -5,7 +5,6 @@
 #include <ModuleBase_WidgetDoubleValue.h>
 
 #include <ModelAPI_AttributeDouble.h>
-#include <ModelAPI_AttributeBoolean.h>
 #include <ModelAPI_Data.h>
 
 #include <Config_Keywords.h>
 #include <QLayout>
 #include <QLabel>
 #include <QDoubleSpinBox>
-#include <QCheckBox>
 
 
 ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, const Config_WidgetAPI* theData)
-  : ModuleBase_ModelWidget(theParent)
+  : ModuleBase_ModelWidget(theParent, theData)
 {
   myContainer = new QWidget(theParent);
   QHBoxLayout* aControlLay = new QHBoxLayout(myContainer);
@@ -34,9 +32,8 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, c
   myLabel->setPixmap(QPixmap(aLabelIcon));
   aControlLay->addWidget(myLabel);
 
-  myAttributeID = theData->widgetId();
   mySpinBox = new QDoubleSpinBox(myContainer);
-  QString anObjName = QString::fromStdString(myAttributeID);
+  QString anObjName = QString::fromStdString(attributeID());
   mySpinBox->setObjectName(anObjName);
 
   bool isOk = false;
@@ -84,7 +81,7 @@ ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue()
 bool ModuleBase_WidgetDoubleValue::storeValue(FeaturePtr theFeature) const
 {
   DataPtr aData = theFeature->data();
-  boost::shared_ptr<ModelAPI_AttributeDouble> aReal = aData->real(myAttributeID);
+  boost::shared_ptr<ModelAPI_AttributeDouble> aReal = aData->real(attributeID());
   if (aReal->value() != mySpinBox->value()) {
     aReal->setValue(mySpinBox->value());
     Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
@@ -95,7 +92,7 @@ bool ModuleBase_WidgetDoubleValue::storeValue(FeaturePtr theFeature) const
 bool ModuleBase_WidgetDoubleValue::restoreValue(FeaturePtr theFeature)
 {
   DataPtr aData = theFeature->data();
-  boost::shared_ptr<ModelAPI_AttributeDouble> aRef = aData->real(myAttributeID);
+  boost::shared_ptr<ModelAPI_AttributeDouble> aRef = aData->real(attributeID());
 
   bool isBlocked = mySpinBox->blockSignals(true);
   mySpinBox->setValue(aRef->value());