1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 * ModuleBase_WidgetFactory.h
6 * Created on: Apr 3, 2014
10 #ifndef MODULEBASE_WIDGETFACTORY_H_
11 #define MODULEBASE_WIDGETFACTORY_H_
13 #include <ModuleBase.h>
14 #include <ModuleBase_ModelWidget.h>
21 class Config_WidgetAPI;
22 class ModuleBase_IWorkshop;
23 class ModuleBase_PageBase;
27 * A class for creation of widgets instances in for property panel using XML deskription of
30 class MODULEBASE_EXPORT ModuleBase_WidgetFactory
34 /// \param theXmlRepresentation content of XML file
35 /// \param theWorkshop reference to workshop instance
36 ModuleBase_WidgetFactory(const std::string& theXmlRepresentation,
37 ModuleBase_IWorkshop* theWorkshop);
38 virtual ~ModuleBase_WidgetFactory();
40 /// Creates content widget for property panel
41 /// \param theParent a parent widget
42 void createWidget(ModuleBase_PageBase* theParent);
45 /// Returns list of model widgets
46 QList<ModuleBase_ModelWidget*> getModelWidgets() const
48 return myModelWidgets;
52 /// check if ModuleBase_Widget has expandable widgets in getControls
53 bool hasExpandingControls(QWidget* theParent);
55 /// Create page by its type
56 /// \param theType a type
57 /// \param theParent a parent widget
58 ModuleBase_PageBase* createPageByType(const std::string& theType,
61 /// Create widget by its type
62 /// \param theType a type
63 /// \param theParent a parent widget
64 ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
65 QWidget* theParent = NULL);
67 /// Convert STD string to QT string
68 /// \param theStdString is STD string
69 static QString qs(const std::string& theStdString);
72 /// API object for XML reading
73 Config_WidgetAPI* myWidgetApi;
75 /// Reference to workshop
76 ModuleBase_IWorkshop* myWorkshop;
78 /// List of created model widgets
79 QList<ModuleBase_ModelWidget*> myModelWidgets;
81 /// Id of current parent
82 std::string myParentId;
85 #endif /* ModuleBase_WidgetFactory_H_ */