![]() |
digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
|
The DConfigDlgMngr class provides a means of automatically retrieving, saving and resetting basic settings. More...
Public Slots | |
void | updateSettings () |
Traverse the specified widgets, saving the settings of all known widgets in the settings object. | |
void | updateWidgets () |
Traverse the specified widgets, sets the state of all known widgets according to the state in the settings object. | |
void | updateWidgetsDefault () |
Traverse the specified widgets, sets the state of all known widgets according to the default state in the settings object. | |
Signals | |
void | settingsChanged () |
One or more of the settings have been saved (such as when the user clicks on the Apply button). | |
void | widgetModified () |
If retrieveSettings() was told to track changes then if any known setting was changed this signal will be emitted. | |
void | widgetSettingsChanged (QWidget *widget) |
One or more of the settings have been changed. | |
Public Member Functions | |
DConfigDlgMngr (QWidget *const parent, KConfigSkeleton *const conf) | |
Constructor. | |
~DConfigDlgMngr () override | |
Destructor. | |
void | addWidget (QWidget *const widget) |
Add additional widgets to manage. | |
bool | hasChanged () const |
Returns whether the current state of the known widgets are different from the state in the config object. | |
bool | isDefault () const |
Returns whether the current state of the known widgets are the same as the default state in the config object. | |
Protected Member Functions | |
QByteArray | getCustomProperty (const QWidget *widget) const |
Find the property to use for a widget by querying the "kcfg_property" property of the widget. | |
QByteArray | getCustomPropertyChangedSignal (const QWidget *widget) const |
Find the changed signal of the property to use for a widget by querying the "kcfg_propertyNotify" property of the widget. | |
QByteArray | getUserProperty (const QWidget *widget) const |
Finds the USER property name using Qt's MetaProperty system, and caches it in the property map (the cache could be retrieved by propertyMap() ). | |
QByteArray | getUserPropertyChangedSignal (const QWidget *widget) const |
Finds the changed signal of the USER property using Qt's MetaProperty system. | |
void | init (bool trackChanges) |
bool | parseChildren (const QWidget *widget, bool trackChanges) |
Recursive function that finds all known children. | |
QVariant | property (QWidget *w) const |
Retrieve a property. | |
void | setProperty (QWidget *w, const QVariant &v) |
Set a property. | |
void | setupWidget (QWidget *widget, KConfigSkeletonItem *item) |
Setup secondary widget properties. | |
Static Protected Member Functions | |
static void | initMaps () |
Initializes the property maps. | |
It also can emit signals when settings have been changed (settings were saved) or modified (the user changes a checkbox from on to off).
The object names of the widgets to be managed have to correspond to the names of the configuration entries in the KConfigSkeleton object plus an additional "kcfg_" prefix. For example a widget with the object name "kcfg_MyOption" would be associated to the configuration entry "MyOption".
The widget classes of Qt are supported out of the box.
Custom widget classes are supported if they have a Q_PROPERTY defined for the property representing the value edited by the widget. By default the property is used for which "USER true" is set. For using another property, see below.
Digikam::DConfigDlgMngr::DConfigDlgMngr | ( | QWidget *const | parent, |
KConfigSkeleton *const | conf | ||
) |
parent | Dialog widget to manage |
conf | Object that contains settings |
void Digikam::DConfigDlgMngr::addWidget | ( | QWidget *const | widget | ) |
widget | Additional widget to manage, including all its children |
|
protected |
Like a widget can use a property other than the USER property.
|
protected |
Like a widget can use a property change signal other than the one for USER property, if there even is one.
|
protected |
trackChanges | - If any changes by the widgets should be tracked set true. This causes the emitting the modified() signal when something changes. |
|
protected |
Goes through the children of widget and if any are known and not being ignored, stores them in currentGroup. Also checks if the widget should be disabled because it is set immutable.
widget | - Parent of the children to look at. |
trackChanges | - If true then tracks any changes to the children of widget that are known. |
|
signal |
This is only emitted by updateSettings() whenever one or more setting were changed and consequently saved.
|
slot |
Example use: User clicks Ok or Apply button in a configure dialog.
|
slot |
Example use: Initialisation of dialog. Example use: User clicks Reset button in a configure dialog.
|
slot |
Example use: User clicks Defaults button in a configure dialog.
|
signal |
Note that a settings can be modified several times and might go back to the original saved state. hasChanged() will tell you if anything has actually changed from the saved values.
|
signal |
widget | - The widget group (pass in via addWidget()) that contains the one or more modified setting. |