Salome HOME
Issue #1854 Recover feature control update
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetShapeSelector.cpp
index 1bcedc636d2b0f5b1aab86c694cf2c79e844104c..8b07d585103bc4bfa081025d1275d10307b767f8 100644 (file)
@@ -13,6 +13,8 @@
 #include <ModuleBase_FilterFactory.h>
 #include <ModuleBase_Filter.h>
 #include <ModuleBase_IModule.h>
+#include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_IconFactory.h>
 
 #include <Config_WidgetAPI.h>
 #include <Events_Loop.h>
@@ -37,7 +39,6 @@
 #include <ModelAPI_AttributeValidator.h>
 
 #include <Config_WidgetAPI.h>
-#include <Events_Error.h>
 
 #include <GeomAPI_Shape.h>
 
@@ -76,7 +77,7 @@ ModuleBase_WidgetShapeSelector::ModuleBase_WidgetShapeSelector(QWidget* theParen
   QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
   myLabel = new QLabel(aLabelText, this);
   if (!aLabelIcon.isEmpty())
-    myLabel->setPixmap(QPixmap(aLabelIcon));
+    myLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon));
 
 
   QString aToolTip = QString::fromStdString(theData->widgetTooltip());
@@ -100,23 +101,24 @@ ModuleBase_WidgetShapeSelector::~ModuleBase_WidgetShapeSelector()
 }
 
 //********************************************************************
-bool ModuleBase_WidgetShapeSelector::storeValueCustom() const
+bool ModuleBase_WidgetShapeSelector::storeValueCustom()
 {
-  // the value is stored on the selection changed signal processing 
+  // the value is stored on the selection changed signal processing
   return true;
 }
 
 //********************************************************************
-bool ModuleBase_WidgetShapeSelector::setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+bool ModuleBase_WidgetShapeSelector::setSelection(QList<ModuleBase_ViewerPrsPtr>& theValues,
                                                   const bool theToValidate)
 {
   if (theValues.empty()) {
     // In order to make reselection possible, set empty object and shape should be done
-    setSelectionCustom(ModuleBase_ViewerPrs());
+    setSelectionCustom(std::shared_ptr<ModuleBase_ViewerPrs>(new ModuleBase_ViewerPrs(
+                                                  ObjectPtr(), GeomShapePtr(), NULL)));
     return false;
   }
   // it removes the processed value from the parameters list
-  ModuleBase_ViewerPrs aValue = theValues.takeFirst();
+  ModuleBase_ViewerPrsPtr aValue = theValues.takeFirst();
   bool isDone = false;
 
   if (!theToValidate || isValidInFilters(aValue)) {
@@ -131,16 +133,16 @@ bool ModuleBase_WidgetShapeSelector::setSelection(QList<ModuleBase_ViewerPrs>& t
 }
 
 //********************************************************************
-QList<ModuleBase_ViewerPrs> ModuleBase_WidgetShapeSelector::getAttributeSelection() const
+QList<ModuleBase_ViewerPrsPtr> ModuleBase_WidgetShapeSelector::getAttributeSelection() const
 {
-  QList<ModuleBase_ViewerPrs> aSelected;
+  QList<ModuleBase_ViewerPrsPtr> aSelected;
   if(myFeature) {
     DataPtr aData = myFeature->data();
     AttributePtr anAttribute = myFeature->attribute(attributeID());
 
     ObjectPtr anObject = ModuleBase_Tools::getObject(anAttribute);
     std::shared_ptr<GeomAPI_Shape> aShapePtr = getShape();
-    ModuleBase_ViewerPrs aPrs(anObject, aShapePtr, NULL);
+    ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs(anObject, aShapePtr, NULL));
     aSelected.append(aPrs);
   }
   return aSelected;
@@ -170,7 +172,7 @@ void ModuleBase_WidgetShapeSelector::updateFocus()
 }
 
 //********************************************************************
-QIntList ModuleBase_WidgetShapeSelector::getShapeTypes() const
+QIntList ModuleBase_WidgetShapeSelector::shapeTypes() const
 {
   QIntList aShapeTypes;
   foreach(QString aType, myShapeTypes) {