Salome HOME
Issue #1348 Creation of a Qt panel: providing additional sample for ModuleBase_ModelW...
[modules/shaper.git] / src / SamplePanelPlugin / SamplePanelPlugin_ModelWidgetCreator.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        SamplePanelPlugin_ModelWidgetCreator.cpp
4 // Created:     29 Mar 2015
5 // Author:      Natalia ERMOLAEVA
6
7 #include "SamplePanelPlugin_ModelWidgetCreator.h"
8 #include "SamplePanelPlugin_ModelWidget.h"
9
10 #include <Config_WidgetAPI.h>
11
12 SamplePanelPlugin_ModelWidgetCreator::SamplePanelPlugin_ModelWidgetCreator()
13 : ModuleBase_IWidgetCreator()
14 {
15   myModelWidgetTypes.insert("QtModelWidget");
16 }
17
18 void SamplePanelPlugin_ModelWidgetCreator::widgetTypes(std::set<std::string>& theTypes)
19 {
20   theTypes = myModelWidgetTypes;
21 }
22
23 ModuleBase_ModelWidget* SamplePanelPlugin_ModelWidgetCreator::createWidgetByType(const std::string& theType,
24                                                             QWidget* theParent,
25                                                             Config_WidgetAPI* theWidgetApi,
26                                                             ModuleBase_IWorkshop* /*theWorkshop*/)
27 {
28   ModuleBase_ModelWidget* aModelWidget = 0;
29   if (myModelWidgetTypes.find(theType) == myModelWidgetTypes.end())
30     return aModelWidget;
31
32   if (theType == "QtModelWidget") {
33     aModelWidget = new SamplePanelPlugin_ModelWidget(theParent, theWidgetApi);
34   }
35
36   return aModelWidget;
37 }