]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp
Salome HOME
Issue #3141 implementation : Allow usage of the same filters many times
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetSelectionFilter.cpp
index f812ac262e3f1de1c8ecc0d2e70be70b59d5a37c..6e916b7ab2c6e870247999018c26a08739a9e6d7 100644 (file)
@@ -143,12 +143,17 @@ ModuleBase_FilterItem::ModuleBase_FilterItem(
   : QWidget(theParent->filtersWidget()), myFilterID(theFilter),
     mySelection(std::dynamic_pointer_cast<ModelAPI_FiltersFeature>(theParent->feature()))
 {
-  std::string aXmlString =
-      ModelAPI_Session::get()->filters()->filter(theFilter)->xmlRepresentation();
+  FilterPtr aFilter = ModelAPI_Session::get()->filters()->filter(theFilter);
+  std::string aXmlString = aFilter->xmlRepresentation();
   if (aXmlString.length() == 0)
     addItemRow(this);
   else {
-    ModuleBase_WidgetFactory aFactory(aXmlString, theParent->workshop());
+    std::string anAttrPrefix; // this must be added to the attributes names for multiple filters
+    std::string aFilterKind = ModelAPI_Session::get()->filters()->id(aFilter);
+    if (theFilter != aFilterKind) {
+      anAttrPrefix = theFilter.substr(0, theFilter.size() - aFilterKind.size());
+    }
+    ModuleBase_WidgetFactory aFactory(aXmlString, theParent->workshop(), anAttrPrefix);
     Config_ValidatorReader aValidatorReader(aXmlString, true);
     aValidatorReader.setFeatureId(mySelection->getKind());
     aValidatorReader.readAll();