Salome HOME
Boost has been removed from code
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetFeature.cpp
index 6586a491a104783222dc1d23b58a43ffa35636c6..3b28aeb6a00f6ab380c1e8af8cd9cce1611409f8 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <ModuleBase_WidgetValueFeature.h>
 #include <ModuleBase_WidgetValue.h>
+#include <ModuleBase_Tools.h>
 
 #include <Config_Keywords.h>
 #include <Config_WidgetAPI.h>
@@ -20,6 +21,7 @@
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_ResultValidator.h>
 #include <ModelAPI_RefAttrValidator.h>
+#include <ModelAPI_Session.h>
 
 #include <QWidget>
 #include <QLineEdit>
@@ -33,7 +35,7 @@ ModuleBase_WidgetFeature::ModuleBase_WidgetFeature(QWidget* theParent,
 {
   myContainer = new QWidget(theParent);
   QHBoxLayout* aControlLay = new QHBoxLayout(myContainer);
-  aControlLay->setContentsMargins(0, 0, 0, 0);
+  ModuleBase_Tools::adjustMargins(aControlLay);
 
   QString aLabelText = QString::fromStdString(theData->widgetLabel());
   myLabel = new QLabel(aLabelText, myContainer);
@@ -47,7 +49,6 @@ ModuleBase_WidgetFeature::ModuleBase_WidgetFeature(QWidget* theParent,
 
   QString aTTip = QString::fromStdString(theData->widgetTooltip());
   myEditor->setToolTip(aTTip);
-
   aControlLay->addWidget(myEditor);
   aControlLay->setStretch(1, 1);
 }
@@ -116,12 +117,12 @@ bool ModuleBase_WidgetFeature::setObject(const ObjectPtr& theObject, bool theSen
 
 bool ModuleBase_WidgetFeature::storeValue() const
 {
-  //FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
+  //FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
   if (!myObject)
     return false;
 
-  boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+  std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
+  std::shared_ptr<ModelAPI_AttributeRefAttr> aRef = std::dynamic_pointer_cast<
       ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
 
   ModuleBase_WidgetFeature* that = (ModuleBase_WidgetFeature*) this;
@@ -133,14 +134,13 @@ bool ModuleBase_WidgetFeature::storeValue() const
 
 bool ModuleBase_WidgetFeature::restoreValue()
 {
-  boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
-  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+  std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
+  std::shared_ptr<ModelAPI_AttributeRefAttr> aRef = std::dynamic_pointer_cast<
       ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
 
-  ObjectPtr aObj = aRef->object();
-  FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aRef->object());
-  if (aFeature) {
-    myObject = aFeature;
+  ObjectPtr anObjPtr = aRef->object();
+  if (anObjPtr) {
+    myObject = anObjPtr;
     myEditor->setText(myObject ? myObject->data()->name().c_str() : "");
     return true;
   }
@@ -155,7 +155,6 @@ QWidget* ModuleBase_WidgetFeature::getControl() const
 QList<QWidget*> ModuleBase_WidgetFeature::getControls() const
 {
   QList<QWidget*> aList;
-  aList.append(myLabel);
   aList.append(myEditor);
   return aList;
 }