• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
KConfigDialogManager Class Reference

#include <kconfigdialogmanager.h>

Inheritance diagram for KConfigDialogManager:
Inheritance graph
[legend]

Public Slots

void updateSettings ()
 
void updateWidgets ()
 
void updateWidgetsDefault ()
 

Signals

void settingsChanged ()
 
void settingsChanged (QWidget *widget)
 
void widgetModified ()
 

Public Member Functions

 KConfigDialogManager (QWidget *parent, KCoreConfigSkeleton *conf)
 
 KConfigDialogManager (QWidget *parent, KConfigSkeleton *conf)
 
 ~KConfigDialogManager ()
 
void addWidget (QWidget *widget)
 
bool hasChanged () const
 
bool isDefault () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Static Public Member Functions

static QHash< QString,
QByteArray > * 
changedMap ()
 
static QHash< QString,
QByteArray > * 
propertyMap ()
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Protected Member Functions

QByteArray getCustomProperty (const QWidget *widget) const
 
QByteArray getUserProperty (const QWidget *widget) const
 
void init (bool trackChanges)
 
bool parseChildren (const QWidget *widget, bool trackChanges)
 
QVariant property (QWidget *w) const
 
void setProperty (QWidget *w, const QVariant &v)
 
void setupWidget (QWidget *widget, KConfigSkeletonItem *item)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Static Protected Member Functions

static void initMaps ()
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 

Detailed Description

Provides a means of automatically retrieving, saving and resetting KConfigSkeleton based settings in a dialog.

The KConfigDialogManager class provides a means of automatically retrieving, saving and resetting basic settings. 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 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 named "kcfg_MyOption" would be associated to the configuration entry "MyOption".

New widgets can be added to the map using the static functions propertyMap() and changedMap(). Note that you can't just add any class. The class must have a matching Q_PROPERTY(...) macro defined, and a signal which emitted when the property changed. Note: by default, the property which defined as "USER true" is used.

For example (note that KColorButton is already added and it doesn't need to manually added):

kcolorbutton.h defines the following property:

Q_PROPERTY( QColor color READ color WRITE setColor USER true )

and signal:

void changed( const QColor &newColor );

To add KColorButton the following code would be inserted in the main:

KConfigDialogManager::changedMap()->insert("KColorButton", SIGNAL(changed(const QColor &)));

If you want to use a widget's property that is not the USER property, you can define which property to use in the widget's kcfg_property:

KUrlRequester *myWidget = new KUrlRequester;
myWidget->setProperty("kcfg_property", QByteArray("text"));

Alternatively you can set the kcfg_property using designer.

Author
Benjamin C Meyer <ben+kdelibs at meyerhome dot net>
Waldo Bastian basti.nosp@m.an@k.nosp@m.de.or.nosp@m.g

Definition at line 85 of file kconfigdialogmanager.h.

Constructor & Destructor Documentation

KConfigDialogManager::KConfigDialogManager ( QWidget *  parent,
KCoreConfigSkeleton *  conf 
)

Constructor.

Parameters
parentDialog widget to manage
confObject that contains settings

Definition at line 69 of file kconfigdialogmanager.cpp.

KConfigDialogManager::KConfigDialogManager ( QWidget *  parent,
KConfigSkeleton *  conf 
)

Constructor.

Parameters
parentDialog widget to manage
confObject that contains settings

Definition at line 77 of file kconfigdialogmanager.cpp.

KConfigDialogManager::~KConfigDialogManager ( )

Destructor.

Definition at line 85 of file kconfigdialogmanager.cpp.

Member Function Documentation

void KConfigDialogManager::addWidget ( QWidget *  widget)

Add additional widgets to manage.

Parameters
widgetAdditional widget to manage, inlcuding all its children

Definition at line 177 of file kconfigdialogmanager.cpp.

QHash< QString, QByteArray > * KConfigDialogManager::changedMap ( )
static

Retrieve the widget change map.

Definition at line 162 of file kconfigdialogmanager.cpp.

QByteArray KConfigDialogManager::getCustomProperty ( const QWidget *  widget) const
protected

Find the property to use for a widget by querying the kcfg_property property of the widget.

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

Since
4.3

Definition at line 436 of file kconfigdialogmanager.cpp.

QByteArray KConfigDialogManager::getUserProperty ( const QWidget *  widget) const
protected

Finds the USER property name using Qt's MetaProperty system, and caches it in the property map (the cache could be retrieved by propertyMap() ).

Definition at line 407 of file kconfigdialogmanager.cpp.

bool KConfigDialogManager::hasChanged ( ) const

Returns whether the current state of the known widgets are different from the state in the config object.

Definition at line 517 of file kconfigdialogmanager.cpp.

void KConfigDialogManager::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. TODO:
Returns
bool - True if any setting was changed from the default.

Definition at line 168 of file kconfigdialogmanager.cpp.

void KConfigDialogManager::initMaps ( )
staticprotected

Initializes the property maps.

Definition at line 90 of file kconfigdialogmanager.cpp.

bool KConfigDialogManager::isDefault ( ) const

Returns whether the current state of the known widgets are the same as the default state in the config object.

Definition at line 539 of file kconfigdialogmanager.cpp.

bool KConfigDialogManager::parseChildren ( const QWidget *  widget,
bool  trackChanges 
)
protected

Recursive function that finds all known children.

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.

Definition at line 225 of file kconfigdialogmanager.cpp.

QVariant KConfigDialogManager::property ( QWidget *  w) const
protected

Retrieve a property.

Definition at line 489 of file kconfigdialogmanager.cpp.

QHash< QString, QByteArray > * KConfigDialogManager::propertyMap ( )
static

Retrieve the property map.

Definition at line 156 of file kconfigdialogmanager.cpp.

void KConfigDialogManager::setProperty ( QWidget *  w,
const QVariant &  v 
)
protected

Set a property.

Definition at line 450 of file kconfigdialogmanager.cpp.

void KConfigDialogManager::settingsChanged ( )
signal

One or more of the settings have been saved (such as when the user clicks on the Apply button).

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

void KConfigDialogManager::settingsChanged ( QWidget *  widget)
signal

TODO: Verify One or more of the settings have been changed.

Parameters
widget- The widget group (pass in via addWidget()) that contains the one or more modified setting.
See also
settingsChanged()
void KConfigDialogManager::setupWidget ( QWidget *  widget,
KConfigSkeletonItem *  item 
)
protected

Setup secondary widget properties.

Definition at line 182 of file kconfigdialogmanager.cpp.

void KConfigDialogManager::updateSettings ( )
slot

Traverse the specified widgets, saving the settings of all known widgets in the settings object.

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

Definition at line 378 of file kconfigdialogmanager.cpp.

void KConfigDialogManager::updateWidgets ( )
slot

Traverse the specified widgets, sets the state of all known widgets according to the state in the settings object.

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

Definition at line 332 of file kconfigdialogmanager.cpp.

void KConfigDialogManager::updateWidgetsDefault ( )
slot

Traverse the specified widgets, sets the state of all known widgets according to the default state in the settings object.

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

Definition at line 371 of file kconfigdialogmanager.cpp.

void KConfigDialogManager::widgetModified ( )
signal

If retrieveSettings() was told to track changes then if any known setting was changed this signal will be emitted.

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.


The documentation for this class was generated from the following files:
  • kconfigdialogmanager.h
  • kconfigdialogmanager.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal