Gui::PrefWidget Class Referenceabstract

The preference widget class. More...

#include <PrefWidgets.h>

Public Member Functions

QByteArray entryName () const
 Returns the widget's preference name. More...
 
virtual void OnChange (Base::Subject< const char * > &rCaller, const char *sReason)
 This method is called if one or more values in the parameter settings are changed where getParamGrp() points to. More...
 
void onRestore ()
 Restores the preferences of the widget. More...
 
void onSave ()
 Saves the current preferences of the widget. More...
 
QByteArray paramGrpPath () const
 Returns the widget's preferences path. More...
 
void setEntryName (const QByteArray &name)
 Sets the preference name to name. More...
 
void setParamGrpPath (const QByteArray &path)
 Sets the preference path to path. More...
 
void setPrefEntry (const QByteArray &name)
 Does the same as setEntryName(). More...
 
void setPrefPath (const QByteArray &name)
 Does the same as setParamGrpPath(). More...
 
- Public Member Functions inherited from Gui::WindowParameter
ParameterGrp::handle getWindowParameter (void)
 return the parameter group of this window More...
 
void OnChange (Base::Subject< const char * > &rCaller, const char *sReason)
 
bool setGroupName (const char *name)
 Sets the group of the window to name. More...
 
 WindowParameter (const char *name)
 
virtual ~WindowParameter ()
 

Protected Member Functions

void failedToRestore (const QString &) const
 Print warning that restoring failed. More...
 
void failedToSave (const QString &) const
 Print warning that saving failed. More...
 
 PrefWidget ()
 Constructs a preference widget. More...
 
virtual void restorePreferences ()=0
 Restores the preferences Must be reimplemented in any subclasses. More...
 
virtual void savePreferences ()=0
 Save the preferences Must be reimplemented in any subclasses. More...
 
virtual ~PrefWidget ()
 Destroys the widget and detaches it from its parameter group. More...
 

Friends

class Gui::WidgetFactoryInst
 

Additional Inherited Members

- Static Public Member Functions inherited from Gui::WindowParameter
static ParameterGrp::handle getDefaultParameter (void)
 get the parameters More...
 

Detailed Description

The preference widget class.

If you want to extend a QWidget class to save/restore its data you just have to derive from this class and implement the methods restorePreferences() and savePreferences().

To restore and save the settings of any widgets in own dialogs you have call onRestore() e.g. in the dialog's constructor and call onSave() e.g. in accept() for each widget you want to enable this mechanism.

For more information of how to use these widgets in normal container widgets which are again in a dialog refer to the description of Gui::Dialog::DlgPreferencesImp.

Author
Werner Mayer

Constructor & Destructor Documentation

◆ PrefWidget()

PrefWidget::PrefWidget ( )
protected

Constructs a preference widget.

◆ ~PrefWidget()

PrefWidget::~PrefWidget ( )
protectedvirtual

Destroys the widget and detaches it from its parameter group.

References Base::Subject< _MessageType >::Detach(), Gui::WindowParameter::getWindowParameter(), and femsolver.elmer.sifio::isValid().

Member Function Documentation

◆ entryName()

◆ failedToRestore()

◆ failedToSave()

◆ OnChange()

void PrefWidget::OnChange ( Base::Subject< const char * > &  rCaller,
const char *  sReason 
)
virtual

This method is called if one or more values in the parameter settings are changed where getParamGrp() points to.

Note: This method is called for each parameter inside the parameter group. So you have to filter out the appropriate parameter with the name sReason. rCaller calls this method.

References restorePreferences().

◆ onRestore()

◆ onSave()

◆ paramGrpPath()

QByteArray PrefWidget::paramGrpPath ( ) const

Returns the widget's preferences path.

Referenced by setParamGrpPath().

◆ restorePreferences()

virtual void Gui::PrefWidget::restorePreferences ( )
protectedpure virtual

◆ savePreferences()

virtual void Gui::PrefWidget::savePreferences ( )
protectedpure virtual

◆ setEntryName()

void PrefWidget::setEntryName ( const QByteArray &  name)

Sets the preference name to name.

Referenced by Gui::WidgetFactoryInst::createPrefWidget(), and setPrefEntry().

◆ setParamGrpPath()

◆ setPrefEntry()

void PrefWidget::setPrefEntry ( const QByteArray &  name)

Does the same as setEntryName().

Sets the preference name to name.

This function is added for convenience because the ui compiler will use this function if the attribute stdset isn't set to 0 in a .ui file.

References setEntryName().

◆ setPrefPath()

void PrefWidget::setPrefPath ( const QByteArray &  name)

Does the same as setParamGrpPath().

Sets the preference path to path.

This function is added for convenience because the ui compiler will use this function if the attribute stdset isn't set to 0 in a .ui file.

References setParamGrpPath().

Friends And Related Function Documentation

◆ Gui::WidgetFactoryInst


The documentation for this class was generated from the following files: