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. More... | |
DlgPreferencesImp (QWidget *parent=0, Qt::WindowFlags fl=0) | |
Constructs a DlgPreferencesImp which is a child of 'parent', with the name 'name' and widget flags set to 'f'. More... | |
~DlgPreferencesImp () | |
Destroys the object and frees any allocated resources. More... | |
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. More... | |
static void | removePage (const std::string &className, const std::string &group) |
Protected Slots | |
void | changeGroup (QListWidgetItem *current, QListWidgetItem *previous) |
void | on_buttonBox_clicked (QAbstractButton *) |
void | resizeWindow (int w, int h) |
Protected Member Functions | |
void | changeEvent (QEvent *e) |
void | resizeEvent (QResizeEvent *) |
void | showEvent (QShowEvent *) |
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:
- Each preference page can be created by the Qt Designer selecting the "Widget" item in the project dialog.
- To save or load the widgets' settings automatically (e.g. combo boxes, line edits, check boxes, ...) you can make use of the classes inherited from PrefWidget such as: PrefSpinBox, PrefLineEdit, PrefComboBox, PrefListBox, PrefCheckBox, PrefRadioButton and PrefSlider. If you have compiled and installed the library under src/Tools/plugins/widgets to QTDIR/plugins/designer you should see the new category "Preferences". Moreover you have to make sure to have specified the "prefEntry" and "prefPath" properties for each preference widget you have used inside your form in Qt Designer.
- For each widget inside your page - you want to save or load - you have to call <objectname>->onSave() or <objectname>->onRestore(). The best way to this is either to define the protected slots saveSettings() and loadSettings() in your form and overwrite them in a subclass or define these slots in this subclass directly.
See the example below for more details:
In the derived class you just have to implement the methods saveSettings() and loadSettings() in the following way:.
- Now you have to make the widget factory to know your class by adding the line new PrefPageProducer<MyPrefPageImp> (QT_TR_NOOP("My category"));
- See also
- PrefWidget
Constructor & Destructor Documentation
◆ DlgPreferencesImp()
DlgPreferencesImp::DlgPreferencesImp | ( | QWidget * | parent = 0 , |
Qt::WindowFlags | 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.
References changeGroup(), and Gui::getMainWindow().
◆ ~DlgPreferencesImp()
DlgPreferencesImp::~DlgPreferencesImp | ( | ) |
Destroys the object and frees any allocated resources.
Member Function Documentation
◆ accept()
void DlgPreferencesImp::accept | ( | ) |
Referenced by ArchComponent.ComponentTaskPanel::editObject().
◆ activateGroupPage()
void DlgPreferencesImp::activateGroupPage | ( | const QString & | group, |
int | id | ||
) |
Activates the page at position index of the group with name group.
Referenced by Gui::Application::sShowPreferences().
◆ addPage()
|
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
Referenced by Gui::PrefPagePyProducer::PrefPagePyProducer(), Gui::PrefPageUiProducer::PrefPageUiProducer(), and Gui::WidgetProducer< CLASS >::Produce().
◆ changeEvent()
|
protected |
◆ changeGroup
|
protectedslot |
Referenced by DlgPreferencesImp().
◆ on_buttonBox_clicked
|
protectedslot |
◆ removePage()
|
static |
◆ resizeEvent()
|
protected |
◆ resizeWindow
|
protectedslot |
◆ showEvent()
|
protected |
The documentation for this class was generated from the following files:
- src/Gui/DlgPreferencesImp.h
- src/Gui/DlgPreferencesImp.cpp