Gui::Dialog::DlgPreferencesImp Class Reference

This class implements a dialog containing several preference pages. More...

#include <DlgPreferencesImp.h>

Inheritance diagram for Gui::Dialog::DlgPreferencesImp:
Gui::Dialog::Ui_DlgPreferences

List of all members.

Public Member Functions

void accept ()
void activateGroupPage (const QString &group, int id)
 Activates the page at position index of the group with name group.
 DlgPreferencesImp (QWidget *parent=0, Qt::WFlags fl=0)
 Constructs a DlgPreferencesImp which is a child of 'parent', with the name 'name' and widget flags set to 'f'.
 ~DlgPreferencesImp ()
 Destroys the object and frees any allocated resources.

Static Public Member Functions

static void addPage (const std::string &className, const std::string &group)
 Adds a preference page with its class name className and the group group it belongs to.
static void removePage (const std::string &className, const std::string &group)

Protected Slots

void changeGroup (QListWidgetItem *current, QListWidgetItem *previous)
void on_buttonApply_clicked ()

Protected Member Functions

void changeEvent (QEvent *e)

Detailed Description

This class implements a dialog containing several preference pages.

To append your own page you just have to take note of these points:

See the example below for more details:

  // This class was created by Qt's uic tool 
  class MyPrefPage : public QWidget
  {
  public:
    MyPrefPage( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 )
    {
      myLineEdit->setProperty( "prefEntry", "lineedit" );
      myLineEdit->setProperty( "prefPath", "GroupName" );
      myCheckBox->setProperty( "prefEntry", "checkbox" );
      myCheckBox->setProperty( "prefPath", "GroupName" );
      ...
    }

    PrefLineEdit* myLineEdit;
    PrefCheckBox* myCheckBox;
 };

In the derived class you just have to implement the methods saveSettings() and loadSettings() in the following way:.

  class MyPrefPageImp : public MyPrefPage
  {
  public:
    MyPrefPageImp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 )
    {
    }
  protected Q_SLOTS:
    void saveSettings()
    {
      myLineEdit->onSave();
      myCheckBox->onSave();
    }
    void loadSettings();
    {
      myLineEdit->onRestore();
      myCheckBox->onRestore();
    }
 };
See also:
PrefWidget
Author:
Werner Mayer, Jürgen Riegel

Definition at line 104 of file DlgPreferencesImp.h.


Constructor & Destructor Documentation

DlgPreferencesImp::DlgPreferencesImp ( QWidget *  parent = 0,
Qt::WFlags  fl = 0 
)

Constructs a DlgPreferencesImp which is a child of 'parent', with the name 'name' and widget flags set to 'f'.

The dialog will by default be modeless, unless you set 'modal' to TRUE to construct a modal dialog.

Definition at line 54 of file DlgPreferencesImp.cpp.

References Gui::Dialog::Ui_DlgPreferences::buttonHelp, changeGroup(), draftlibs::fcgeo::connect(), Gui::getMainWindow(), Gui::Dialog::Ui_DlgPreferences::listBox, and Gui::Dialog::Ui_DlgPreferences::setupUi().

DlgPreferencesImp::~DlgPreferencesImp (  ) 

Destroys the object and frees any allocated resources.

Definition at line 68 of file DlgPreferencesImp.cpp.


Member Function Documentation

void DlgPreferencesImp::accept (  ) 

Definition at line 179 of file DlgPreferencesImp.cpp.

References on_buttonApply_clicked().

void DlgPreferencesImp::activateGroupPage ( const QString &  group,
int  id 
)

Activates the page at position index of the group with name group.

Definition at line 165 of file DlgPreferencesImp.cpp.

References Gui::Dialog::Ui_DlgPreferences::listBox, and Gui::Dialog::Ui_DlgPreferences::tabWidgetStack.

void DlgPreferencesImp::addPage ( const std::string &  className,
const std::string &  group 
) [static]

Adds a preference page with its class name className and the group group it belongs to.

To create this page it must be registered in the WidgetFactory.

See also:
WidgetFactory
PrefPageProducer

Definition at line 125 of file DlgPreferencesImp.cpp.

Referenced by Gui::PrefPageProducer< CLASS >::PrefPageProducer(), and Gui::PrefPageUiProducer::PrefPageUiProducer().

void DlgPreferencesImp::changeEvent ( QEvent *  e  )  [protected]
void DlgPreferencesImp::changeGroup ( QListWidgetItem *  current,
QListWidgetItem *  previous 
) [protected, slot]
void DlgPreferencesImp::on_buttonApply_clicked (  )  [protected, slot]
void DlgPreferencesImp::removePage ( const std::string &  className,
const std::string &  group 
) [static]

Definition at line 139 of file DlgPreferencesImp.cpp.

References draftTools::p.


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

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