Salome HOME
Copyright update 2022
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetFactory.cpp
index 7f51a61a7cebe597e8b0cb4c1b41f1636c814238..a5824c6f2a26360a6020cff4aac2616b3851c7b6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include <climits>
 
 ModuleBase_WidgetFactory::ModuleBase_WidgetFactory(const std::string& theXmlRepresentation,
-                                                   ModuleBase_IWorkshop* theWorkshop)
+                                                   ModuleBase_IWorkshop* theWorkshop,
+                                                   const std::string theAttributePrefix)
     : myWorkshop(theWorkshop)
 {
-  myWidgetApi = new Config_WidgetAPI(theXmlRepresentation);
+  myWidgetApi = new Config_WidgetAPI(theXmlRepresentation, theAttributePrefix);
 }
 
 ModuleBase_WidgetFactory::~ModuleBase_WidgetFactory()
@@ -161,8 +162,12 @@ void ModuleBase_WidgetFactory::createPanel(ModuleBase_PageBase* thePage,
   std::string aPanelName = myWidgetApi->getProperty(PROPERTY_PANEL_ID);
   if (!aPanelName.empty() && ModuleBase_WidgetCreatorFactory::get()->hasPanelWidget(aPanelName)) {
     QWidget* aPanel = ModuleBase_WidgetCreatorFactory::get()->createPanelByType(aPanelName,
-                                                               thePage->pageWidget(), theFeature);
-    thePage->addWidget(aPanel);
+        thePage->pageWidget(), theFeature, myWidgetApi);
+    ModuleBase_ModelWidget* aModelWdg = dynamic_cast<ModuleBase_ModelWidget*>(aPanel);
+    if (aModelWdg)
+      thePage->addModelWidget(aModelWdg);
+    else
+      thePage->addWidget(aPanel);
     thePage->alignToTop();
   }
 }
@@ -185,8 +190,8 @@ void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase* thePage,
         aWidget->setVisible(false);
       }
     }
+    thePage->alignToTop();
   }
-  thePage->alignToTop();
 }
 
 void ModuleBase_WidgetFactory::getAttributeTitle(const std::string& theAttributeId,
@@ -200,6 +205,8 @@ void ModuleBase_WidgetFactory::getAttributeTitle(const std::string& theAttribute
       theTitle =
       QString::fromStdString(myWidgetApi->getProperty(CONTAINER_PAGE_NAME)).toStdString().c_str();
   }
+  else
+    theTitle = theAttributeId;
 }
 
 void ModuleBase_WidgetFactory::getGreedAttribute(std::string& theAttributeId)