This class implements a dialog containing several preference pages. More...
#include <DlgPreferencesImp.h>
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) |
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(); } };
Definition at line 104 of file DlgPreferencesImp.h.
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.
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.
Definition at line 125 of file DlgPreferencesImp.cpp.
Referenced by Gui::PrefPageProducer< CLASS >::PrefPageProducer(), and Gui::PrefPageUiProducer::PrefPageUiProducer().
void DlgPreferencesImp::changeEvent | ( | QEvent * | e | ) | [protected] |
Definition at line 222 of file DlgPreferencesImp.cpp.
References Gui::Dialog::Ui_DlgPreferences::listBox, Gui::Dialog::Ui_DlgPreferences::retranslateUi(), and Gui::Dialog::Ui_DlgPreferences::tabWidgetStack.
void DlgPreferencesImp::changeGroup | ( | QListWidgetItem * | current, | |
QListWidgetItem * | previous | |||
) | [protected, slot] |
Definition at line 111 of file DlgPreferencesImp.cpp.
References Gui::Dialog::Ui_DlgPreferences::listBox, and Gui::Dialog::Ui_DlgPreferences::tabWidgetStack.
Referenced by DlgPreferencesImp().
void DlgPreferencesImp::on_buttonApply_clicked | ( | ) | [protected, slot] |
Definition at line 187 of file DlgPreferencesImp.cpp.
References Gui::Dialog::Ui_DlgPreferences::listBox, Gui::Dialog::PreferencePage::saveSettings(), Gui::Dialog::Ui_DlgPreferences::tabWidgetStack, and Base::Exception::what().
Referenced by accept().
void DlgPreferencesImp::removePage | ( | const std::string & | className, | |
const std::string & | group | |||
) | [static] |
Definition at line 139 of file DlgPreferencesImp.cpp.
References draftTools::p.