Gui::PrefWidget Class Reference

The preference widget class. More...

#include <PrefWidgets.h>

Inheritance diagram for Gui::PrefWidget:
Gui::WindowParameter Gui::PrefCheckBox Gui::PrefColorButton Gui::PrefComboBox Gui::PrefDoubleSpinBox Gui::PrefFileChooser Gui::PrefLineEdit Gui::PrefRadioButton Gui::PrefSlider Gui::PrefSpinBox

List of all members.

Public Member Functions

virtual QByteArray entryName () const
 Returns the widget's preference name.
virtual void OnChange (Base::Subject< const char * > &rCaller, const char *sReason)
 This method is called if one ore more values in the parameter settings are changed where getParamGrp() points to.
void onRestore ()
 Restores the preferences of the widget.
void onSave ()
 Saves the current preferences of the widget.
virtual QByteArray paramGrpPath () const
 Returns the widget's preferences path.
virtual void setEntryName (const QByteArray &name)
 Sets the preference name to name.
virtual void setParamGrpPath (const QByteArray &path)
 Sets the preference path to path.

Protected Member Functions

 PrefWidget ()
 Constructs a preference widget.
virtual void restorePreferences ()=0
 Restores the preferences Must be reimplemented in any subclasses.
virtual void savePreferences ()=0
 Save the preferences Must be reimplemented in any subclasses.
virtual ~PrefWidget ()
 Destroys the widget and detaches it from its parameter group.

Friends

class Gui::WidgetFactoryInst

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

Definition at line 54 of file PrefWidgets.h.


Constructor & Destructor Documentation

PrefWidget::PrefWidget (  )  [protected]

Constructs a preference widget.

Definition at line 37 of file PrefWidgets.cpp.

PrefWidget::~PrefWidget (  )  [protected, virtual]

Destroys the widget and detaches it from its parameter group.

Definition at line 45 of file PrefWidgets.cpp.

References Gui::WindowParameter::getWindowParameter().


Member Function Documentation

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

This method is called if one ore 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.

Reimplemented from Gui::WindowParameter.

Definition at line 98 of file PrefWidgets.cpp.

References restorePreferences().

void PrefWidget::onRestore (  ) 
void PrefWidget::onSave (  ) 
QByteArray PrefWidget::paramGrpPath (  )  const [virtual]
virtual void Gui::PrefWidget::restorePreferences (  )  [protected, pure virtual]

Restores the preferences Must be reimplemented in any subclasses.

Implemented in Gui::PrefSpinBox, Gui::PrefDoubleSpinBox, Gui::PrefLineEdit, Gui::PrefFileChooser, Gui::PrefComboBox, Gui::PrefCheckBox, Gui::PrefRadioButton, Gui::PrefSlider, and Gui::PrefColorButton.

Referenced by OnChange(), and onRestore().

virtual void Gui::PrefWidget::savePreferences (  )  [protected, pure virtual]

Save the preferences Must be reimplemented in any subclasses.

Implemented in Gui::PrefSpinBox, Gui::PrefDoubleSpinBox, Gui::PrefLineEdit, Gui::PrefFileChooser, Gui::PrefComboBox, Gui::PrefCheckBox, Gui::PrefRadioButton, Gui::PrefSlider, and Gui::PrefColorButton.

Referenced by onSave().

void PrefWidget::setEntryName ( const QByteArray &  name  )  [virtual]
void PrefWidget::setParamGrpPath ( const QByteArray &  path  )  [virtual]

Friends And Related Function Documentation

friend class Gui::WidgetFactoryInst [friend]

Definition at line 85 of file PrefWidgets.h.


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

Generated on Wed Nov 23 19:02:01 2011 for FreeCAD by  doxygen 1.6.1