digiKam Developer Documentation: Digikam::DConfigDlgMngr Class Reference

| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
Digikam::DConfigDlgMngr Class Reference

The DConfigDlgMngr class provides a means of automatically retrieving, saving and resetting basic settings. More...

Inheritance diagram for Digikam::DConfigDlgMngr:

## 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.

## Static Public Member Functions
static QHash< QString, QByteArray > * | changedMap ()
| Retrieve the map between widgets class names and signals that are listened to detect changes in the configuration values.
static QHash< QString, QByteArray > * | propertyMap ()
| Retrieve the map between widgets class names and the USER properties used for the configuration values.

## 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.

## Detailed Description

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.

## Constructor & Destructor Documentation

## ◆ DConfigDlgMngr()

Digikam::DConfigDlgMngr::DConfigDlgMngr | ( | QWidget *const | parent,
|  | KConfigSkeleton *const | conf
| ) |  |

Parameters

  parent | Dialog widget to manage
  conf | Object that contains settings

## Member Function Documentation

## ◆ addWidget()

void Digikam::DConfigDlgMngr::addWidget | ( | QWidget *const | widget | ) |

Parameters

  widget | Additional widget to manage, including all its children

## ◆ getCustomProperty()

QByteArray Digikam::DConfigDlgMngr::getCustomProperty | ( | const QWidget * | widget | ) | const
| protected

Like a widget can use a property other than the USER property.

## ◆ getCustomPropertyChangedSignal()

QByteArray Digikam::DConfigDlgMngr::getCustomPropertyChangedSignal | ( | const QWidget * | widget | ) | const
| protected

Like a widget can use a property change signal other than the one for USER property, if there even is one.

## ◆ init()

void Digikam::DConfigDlgMngr::init | ( | bool | trackChanges | ) |
| protected

Parameters

  trackChanges | - If any changes by the widgets should be tracked set true. This causes the emitting the modified() signal when something changes.

## ◆ parseChildren()

bool Digikam::DConfigDlgMngr::parseChildren | ( | const QWidget * | widget,
|  | bool | trackChanges
| ) |  |
| 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.

Parameters

  widget | - Parent of the children to look at.
  trackChanges | - If true then tracks any changes to the children of widget that are known.

Returns
  bool - If a widget was set to something other than its default.

## ◆ settingsChanged

void Digikam::DConfigDlgMngr::settingsChanged | ( |  | ) |
| signal

This is only emitted by updateSettings() whenever one or more setting were changed and consequently saved.

## ◆ updateSettings

void Digikam::DConfigDlgMngr::updateSettings | ( |  | ) |
| slot

Example use: User clicks Ok or Apply button in a configure dialog.

## ◆ updateWidgets

void Digikam::DConfigDlgMngr::updateWidgets | ( |  | ) |
| slot

Example use: Initialisation of dialog. Example use: User clicks Reset button in a configure dialog.

## ◆ updateWidgetsDefault

void Digikam::DConfigDlgMngr::updateWidgetsDefault | ( |  | ) |
| slot

Example use: User clicks Defaults button in a configure dialog.

## ◆ widgetModified

void Digikam::DConfigDlgMngr::widgetModified | ( |  | ) |
| 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.

## ◆ widgetSettingsChanged

void Digikam::DConfigDlgMngr::widgetSettingsChanged | ( | QWidget * | widget | ) |
| signal

Parameters

  widget | - The widget group (pass in via addWidget()) that contains the one or more modified setting.

See also
  settingsChanged()