SHAPER  9.12.0
ModuleBase_WidgetFactory Class Reference

A class for creation of widgets instances in for property panel using XML deskription of a feature. More...

Public Member Functions

 ModuleBase_WidgetFactory (const std::string &theXmlRepresentation, ModuleBase_IWorkshop *theWorkshop, const std::string theAttributePrefix="")
 Constructor. More...
 
void createWidget (ModuleBase_PageBase *thePage, bool alignToTop=true)
 Creates content widget for property panel. More...
 
void createPanel (ModuleBase_PageBase *thePage, const FeaturePtr &theFeature)
 Creates property panel content for the feature. More...
 
void createWidget (ModuleBase_PageBase *thePage, const std::string &theWidgetId)
 Creates one widget for property panel for the widget with given index. More...
 
QList< ModuleBase_ModelWidget * > getModelWidgets () const
 Returns list of model widgets. More...
 
void getAttributeTitle (const std::string &theAttributeId, std::string &theTitle)
 Returns the value of the title key from XML definition of the attribute in the feature. More...
 
void getGreedAttribute (std::string &theAttributeId)
 Returns the identifier of the first found attribute where greed field value is set and true. More...
 
const Config_WidgetAPIwidgetAPI () const
 Returns widget API from XML. More...
 

Protected Member Functions

bool hasExpandingControls (QWidget *theParent)
 check if ModuleBase_Widget has expandable widgets in getControls More...
 
ModuleBase_PageBasecreatePageByType (const std::string &theType, QWidget *theParent)
 Create page by its type. More...
 
ModuleBase_ModelWidgetcreateWidgetByType (const std::string &theType, QWidget *theParent=NULL)
 Create widget by its type. More...
 
void moveToWidgetId (const std::string &theWidgetId, bool &theFound)
 It updates internal config api to point in the structure to given id of widget The method is recusive and it stops when the found flag is true. More...
 

Static Protected Member Functions

static QString qs (const std::string &theStdString)
 Convert STD string to QT string. More...
 

Detailed Description

A class for creation of widgets instances in for property panel using XML deskription of a feature.

Constructor & Destructor Documentation

◆ ModuleBase_WidgetFactory()

ModuleBase_WidgetFactory::ModuleBase_WidgetFactory ( const std::string &  theXmlRepresentation,
ModuleBase_IWorkshop theWorkshop,
const std::string  theAttributePrefix = "" 
)

Constructor.

Parameters
theXmlRepresentationcontent of XML file
theWorkshopreference to workshop instance
theAttributePrefixprefix that must be added to the attribute name

Member Function Documentation

◆ createWidget() [1/2]

void ModuleBase_WidgetFactory::createWidget ( ModuleBase_PageBase thePage,
bool  alignToTop = true 
)

Creates content widget for property panel.

Parameters
thePagea parent page
alignToTopalign to top flag (true by default)

◆ createPanel()

void ModuleBase_WidgetFactory::createPanel ( ModuleBase_PageBase thePage,
const FeaturePtr &  theFeature 
)

Creates property panel content for the feature.

Parameters
thePagea parent page
theFeaturea feature to fill the panel

◆ createWidget() [2/2]

void ModuleBase_WidgetFactory::createWidget ( ModuleBase_PageBase thePage,
const std::string &  theWidgetId 
)

Creates one widget for property panel for the widget with given index.

Parameters
thePagea parent widget
theWidgetIda widget index

◆ getModelWidgets()

QList<ModuleBase_ModelWidget*> ModuleBase_WidgetFactory::getModelWidgets ( ) const
inline

Returns list of model widgets.

◆ getAttributeTitle()

void ModuleBase_WidgetFactory::getAttributeTitle ( const std::string &  theAttributeId,
std::string &  theTitle 
)

Returns the value of the title key from XML definition of the attribute in the feature.

Parameters
theAttributeIda value of a kind of the attribute under the feature
theTitlethe result title

◆ getGreedAttribute()

void ModuleBase_WidgetFactory::getGreedAttribute ( std::string &  theAttributeId)

Returns the identifier of the first found attribute where greed field value is set and true.

Parameters
theAttributeIdan outpup parameter with attribute

◆ widgetAPI()

const Config_WidgetAPI* ModuleBase_WidgetFactory::widgetAPI ( ) const
inline

Returns widget API from XML.

◆ hasExpandingControls()

bool ModuleBase_WidgetFactory::hasExpandingControls ( QWidget theParent)
protected

check if ModuleBase_Widget has expandable widgets in getControls

◆ createPageByType()

ModuleBase_PageBase * ModuleBase_WidgetFactory::createPageByType ( const std::string &  theType,
QWidget theParent 
)
protected

Create page by its type.

Parameters
theTypea type
theParenta parent widget

◆ createWidgetByType()

ModuleBase_ModelWidget * ModuleBase_WidgetFactory::createWidgetByType ( const std::string &  theType,
QWidget theParent = NULL 
)
protected

Create widget by its type.

Parameters
theTypea type
theParenta parent widget

◆ qs()

QString ModuleBase_WidgetFactory::qs ( const std::string &  theStdString)
staticprotected

Convert STD string to QT string.

Parameters
theStdStringis STD string

◆ moveToWidgetId()

void ModuleBase_WidgetFactory::moveToWidgetId ( const std::string &  theWidgetId,
bool &  theFound 
)
protected

It updates internal config api to point in the structure to given id of widget The method is recusive and it stops when the found flag is true.

Parameters
theWidgetIda widget id key value
theFounda flag about found windget and recursive search should be stopped