SHAPER  9.12.0
ModuleBase_WidgetValidator Class Reference

Implementation of widget with validators and filters processing. More...

Public Member Functions

 ModuleBase_WidgetValidator (ModuleBase_ModelWidget *theModelWidget, ModuleBase_IWorkshop *theWorkshop)
 Constructor. More...
 
virtual void selectionModes (int &, QIntList &)
 Fills given container with selection modes if the widget has it. More...
 
virtual void selectionFilters (QIntList &theModuleSelectionFilters, SelectMgr_ListOfFilter &theSelectionFilters)
 Appends into container of workshop selection filters. More...
 
bool isInValidate () const
 Returns true if the validation is activated. More...
 
virtual bool isValidSelection (const std::shared_ptr< ModuleBase_ViewerPrs > &theValue)
 Checks all widget validator if the owner is valid. More...
 
virtual void storeAttributeValue (const std::shared_ptr< ModelAPI_Attribute > &theAttribute)
 Creates a backup of the current values of the attribute. More...
 
virtual void restoreAttributeValue (const std::shared_ptr< ModelAPI_Attribute > &theAttribute, const bool theValid)
 Creates a backup of the current values of the attribute It should be realized in the specific widget because of different parameters of the current attribute. More...
 
bool isValidAttribute (const std::shared_ptr< ModelAPI_Attribute > &theAttribute) const
 Checks the current attibute in all attribute validators. More...
 
void clearValidatedCash ()
 Clear all validated cash in the widget. More...
 

Protected Attributes

bool myIsInValidate
 cashed if the value is processed in validation More...
 
ModuleBase_ModelWidgetmyModelWidget
 Reference to workshop. More...
 
ModuleBase_IWorkshopmyWorkshop
 the active workshop More...
 
ModuleBase_WidgetSelectorStoremyAttributeStore
 store/restore attribute values More...
 
QList< std::shared_ptr< ModuleBase_ViewerPrs > > myValidPrs
 cash of valid selection presentations More...
 
QList< std::shared_ptr< ModuleBase_ViewerPrs > > myInvalidPrs
 cash of invalid selection presentations More...
 

Detailed Description

Implementation of widget with validators and filters processing.

Constructor & Destructor Documentation

◆ ModuleBase_WidgetValidator()

ModuleBase_WidgetValidator::ModuleBase_WidgetValidator ( ModuleBase_ModelWidget theModelWidget,
ModuleBase_IWorkshop theWorkshop 
)

Constructor.

Parameters
theModelWidgetthe model widget to be validated
theWorkshopthe current workshop

Member Function Documentation

◆ selectionModes()

virtual void ModuleBase_WidgetValidator::selectionModes ( int &  ,
QIntList &   
)
inlinevirtual

Fills given container with selection modes if the widget has it.

Parameters
[out]theModuleSelectionModesmodule additional modes, -1 means all default modes
theModes[out] a container of modes

◆ selectionFilters()

void ModuleBase_WidgetValidator::selectionFilters ( QIntList &  theModuleSelectionFilters,
SelectMgr_ListOfFilter &  theSelectionFilters 
)
virtual

Appends into container of workshop selection filters.

Parameters
[out]theModuleSelectionFiltersmodule additional modes, -1 means all default modes
[out]selectionfilters

◆ isInValidate()

bool ModuleBase_WidgetValidator::isInValidate ( ) const
inline

Returns true if the validation is activated.

◆ isValidSelection()

bool ModuleBase_WidgetValidator::isValidSelection ( const std::shared_ptr< ModuleBase_ViewerPrs > &  theValue)
virtual

Checks all widget validator if the owner is valid.

Firstly it checks custom widget validating, next, the attribute's validating. It trying on the give selection to current attribute by setting the value inside and calling validators. After this, the previous attribute value is restored.The valid/invalid value is cashed.

Parameters
theValuea selected presentation in the view
Returns
a boolean value

◆ storeAttributeValue()

void ModuleBase_WidgetValidator::storeAttributeValue ( const std::shared_ptr< ModelAPI_Attribute > &  theAttribute)
virtual

Creates a backup of the current values of the attribute.

It should be realized in the specific widget because of different parameters of the current attribute

Parameters
theAttributean attribute to be stored

◆ restoreAttributeValue()

void ModuleBase_WidgetValidator::restoreAttributeValue ( const std::shared_ptr< ModelAPI_Attribute > &  theAttribute,
const bool  theValid 
)
virtual

Creates a backup of the current values of the attribute It should be realized in the specific widget because of different parameters of the current attribute.

Parameters
theAttributean attribute to be restored
theValida boolean flag, if restore happens for valid parameters

◆ isValidAttribute()

bool ModuleBase_WidgetValidator::isValidAttribute ( const std::shared_ptr< ModelAPI_Attribute > &  theAttribute) const

Checks the current attibute in all attribute validators.

Parameters
theAttributean attribute to be validated
Returns
true if all validators return that the attribute is valid

◆ clearValidatedCash()

void ModuleBase_WidgetValidator::clearValidatedCash ( )

Clear all validated cash in the widget.

Field Documentation

◆ myIsInValidate

bool ModuleBase_WidgetValidator::myIsInValidate
protected

cashed if the value is processed in validation

◆ myModelWidget

ModuleBase_ModelWidget* ModuleBase_WidgetValidator::myModelWidget
protected

Reference to workshop.

the current widget to be validated

◆ myWorkshop

ModuleBase_IWorkshop* ModuleBase_WidgetValidator::myWorkshop
protected

the active workshop

◆ myAttributeStore

ModuleBase_WidgetSelectorStore* ModuleBase_WidgetValidator::myAttributeStore
protected

store/restore attribute values

◆ myValidPrs

QList<std::shared_ptr<ModuleBase_ViewerPrs> > ModuleBase_WidgetValidator::myValidPrs
protected

cash of valid selection presentations

◆ myInvalidPrs

QList<std::shared_ptr<ModuleBase_ViewerPrs> > ModuleBase_WidgetValidator::myInvalidPrs
protected

cash of invalid selection presentations