KCoreConfigSkeleton
#include <KCoreConfigSkeleton>

Classes | |
class | ItemBool |
class | ItemDateTime |
class | ItemDouble |
class | ItemEnum |
class | ItemInt |
class | ItemIntList |
class | ItemLongLong |
class | ItemPassword |
class | ItemPath |
class | ItemPathList |
class | ItemPoint |
class | ItemProperty |
class | ItemRect |
class | ItemSize |
class | ItemString |
class | ItemStringList |
class | ItemUInt |
class | ItemULongLong |
class | ItemUrl |
class | ItemUrlList |
Public Types | |
typedef ItemLongLong | ItemInt64 |
typedef ItemULongLong | ItemUInt64 |
Signals | |
void | configChanged () |
Public Slots | |
bool | save () |
void | writeConfig () |
Public Member Functions | |
KCoreConfigSkeleton (const QString &configname=QString(), QObject *parent=nullptr) | |
KCoreConfigSkeleton (KSharedConfig::Ptr config, QObject *parent=nullptr) | |
~KCoreConfigSkeleton () override | |
void | addItem (KConfigSkeletonItem *item, const QString &name=QString()) |
ItemBool * | addItemBool (const QString &name, bool &reference, bool defaultValue=false, const QString &key=QString()) |
ItemDateTime * | addItemDateTime (const QString &name, QDateTime &reference, const QDateTime &defaultValue=QDateTime(), const QString &key=QString()) |
ItemDouble * | addItemDouble (const QString &name, double &reference, double defaultValue=0.0, const QString &key=QString()) |
ItemInt * | addItemInt (const QString &name, qint32 &reference, qint32 defaultValue=0, const QString &key=QString()) |
ItemLongLong * | addItemInt64 (const QString &name, qint64 &reference, qint64 defaultValue=0, const QString &key=QString()) |
ItemIntList * | addItemIntList (const QString &name, QList< int > &reference, const QList< int > &defaultValue=QList< int >(), const QString &key=QString()) |
ItemLongLong * | addItemLongLong (const QString &name, qint64 &reference, qint64 defaultValue=0, const QString &key=QString()) |
ItemPassword * | addItemPassword (const QString &name, QString &reference, const QString &defaultValue=QLatin1String(""), const QString &key=QString()) |
ItemPath * | addItemPath (const QString &name, QString &reference, const QString &defaultValue=QLatin1String(""), const QString &key=QString()) |
ItemPoint * | addItemPoint (const QString &name, QPoint &reference, const QPoint &defaultValue=QPoint(), const QString &key=QString()) |
ItemProperty * | addItemProperty (const QString &name, QVariant &reference, const QVariant &defaultValue=QVariant(), const QString &key=QString()) |
ItemRect * | addItemRect (const QString &name, QRect &reference, const QRect &defaultValue=QRect(), const QString &key=QString()) |
ItemSize * | addItemSize (const QString &name, QSize &reference, const QSize &defaultValue=QSize(), const QString &key=QString()) |
ItemString * | addItemString (const QString &name, QString &reference, const QString &defaultValue=QLatin1String(""), const QString &key=QString()) |
ItemStringList * | addItemStringList (const QString &name, QStringList &reference, const QStringList &defaultValue=QStringList(), const QString &key=QString()) |
ItemUInt * | addItemUInt (const QString &name, quint32 &reference, quint32 defaultValue=0, const QString &key=QString()) |
ItemULongLong * | addItemUInt64 (const QString &name, quint64 &reference, quint64 defaultValue=0, const QString &key=QString()) |
ItemULongLong * | addItemULongLong (const QString &name, quint64 &reference, quint64 defaultValue=0, const QString &key=QString()) |
void | clearItems () |
KConfig * | config () |
const KConfig * | config () const |
QString | currentGroup () const |
KConfigSkeletonItem * | findItem (const QString &name) const |
bool | isDefaults () const |
Q_INVOKABLE bool | isImmutable (const QString &name) const |
bool | isSaveNeeded () const |
KConfigSkeletonItem::List | items () const |
void | load () |
void | read () |
void | readConfig () |
void | removeItem (const QString &name) |
void | setCurrentGroup (const QString &group) |
virtual void | setDefaults () |
void | setSharedConfig (KSharedConfig::Ptr pConfig) |
KSharedConfig::Ptr | sharedConfig () const |
virtual bool | useDefaults (bool b) |
![]() | |
QObject (QObject *parent) | |
bool | blockSignals (bool block) |
const QObjectList & | children () const const |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectInfo () |
void | dumpObjectInfo () const const |
void | dumpObjectTree () |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_OBJECT Q_OBJECT | |
Q_PROPERTY (...) | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
Q_SIGNAL Q_SIGNAL | |
Q_SIGNALS Q_SIGNALS | |
Q_SLOT Q_SLOT | |
Q_SLOTS Q_SLOTS | |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
QThread * | thread () const const |
Protected Member Functions | |
virtual void | usrRead () |
virtual void | usrReadConfig () |
virtual bool | usrSave () |
virtual void | usrSetDefaults () |
virtual bool | usrUseDefaults (bool b) |
virtual bool | usrWriteConfig () |
![]() | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
bool | isSignalConnected (const QMetaMethod &signal) const const |
int | receivers (const char *signal) const const |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
![]() | |
objectName | |
![]() | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
bool | disconnect (const QMetaObject::Connection &connection) |
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) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
![]() | |
typedef | QObjectList |
Detailed Description
Class for handling preferences settings for an application.
This class provides an interface to preferences settings. Preferences items can be registered by the addItem() function corresponding to the data type of the setting. KCoreConfigSkeleton then handles reading and writing of config files and setting of default values.
Normally you will subclass KCoreConfigSkeleton, add data members for the preferences settings and register the members in the constructor of the subclass.
Example:
It might be convenient in many cases to make this subclass of KCoreConfigSkeleton a singleton for global access from all over the application without passing references to the KCoreConfigSkeleton object around.
You can write the data to the configuration file by calling save() and read the data from the configuration file by calling readConfig(). If you want to watch for config changes, use configChanged() signal.
If you have items, which are not covered by the existing addItem() functions you can add customized code for reading, writing and default setting by implementing the functions usrUseDefaults(), usrRead() and usrSave().
Internally preferences settings are stored in instances of subclasses of KConfigSkeletonItem. You can also add KConfigSkeletonItem subclasses for your own types and call the generic addItem() to register them.
In many cases you don't have to write the specific KCoreConfigSkeleton subclasses yourself, but you can use The KDE Configuration Compiler to automatically generate the C++ code from an XML description of the configuration options.
Use KConfigSkeleton if you need GUI types as well.
- See also
- KConfigSkeletonItem
Definition at line 550 of file kcoreconfigskeleton.h.
Constructor & Destructor Documentation
◆ KCoreConfigSkeleton() [1/2]
|
explicit |
Constructor.
- Parameters
-
configname name of config file. If no name is given, the default config file as returned by KSharedConfig::openConfig() is used parent the parent object (see QObject documentation)
Definition at line 1124 of file kcoreconfigskeleton.cpp.
◆ KCoreConfigSkeleton() [2/2]
|
explicit |
Constructor.
- Parameters
-
config configuration object to use parent the parent object (see QObject documentation)
Definition at line 1133 of file kcoreconfigskeleton.cpp.
◆ ~KCoreConfigSkeleton()
|
override |
Destructor.
Definition at line 1141 of file kcoreconfigskeleton.cpp.
Member Function Documentation
◆ addItem()
void KCoreConfigSkeleton::addItem | ( | KConfigSkeletonItem * | item, |
const QString & | name = QString() |
||
) |
Register a custom KConfigSkeletonItem item
with a given name
.
If name
is a null string, take the name from KConfigSkeletonItem::key().
- Note
- All names must be unique but multiple entries can have the same key if they reside in different groups.
KCoreConfigSkeleton takes ownership of item
.
Definition at line 1290 of file kcoreconfigskeleton.cpp.
◆ addItemBool()
KCoreConfigSkeleton::ItemBool * KCoreConfigSkeleton::addItemBool | ( | const QString & | name, |
bool & | reference, | ||
bool | defaultValue = false , |
||
const QString & | key = QString() |
||
) |
Register an item of type bool
.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1362 of file kcoreconfigskeleton.cpp.
◆ addItemDateTime()
KCoreConfigSkeleton::ItemDateTime * KCoreConfigSkeleton::addItemDateTime | ( | const QString & | name, |
QDateTime & | reference, | ||
const QDateTime & | defaultValue = QDateTime() , |
||
const QString & | key = QString() |
||
) |
Register an item of type QDateTime.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1449 of file kcoreconfigskeleton.cpp.
◆ addItemDouble()
KCoreConfigSkeleton::ItemDouble * KCoreConfigSkeleton::addItemDouble | ( | const QString & | name, |
double & | reference, | ||
double | defaultValue = 0.0 , |
||
const QString & | key = QString() |
||
) |
Register an item of type double
.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1416 of file kcoreconfigskeleton.cpp.
◆ addItemInt()
KCoreConfigSkeleton::ItemInt * KCoreConfigSkeleton::addItemInt | ( | const QString & | name, |
qint32 & | reference, | ||
qint32 | defaultValue = 0 , |
||
const QString & | key = QString() |
||
) |
Register an item of type qint32
.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1370 of file kcoreconfigskeleton.cpp.
◆ addItemInt64()
KCoreConfigSkeleton::ItemLongLong * KCoreConfigSkeleton::addItemInt64 | ( | const QString & | name, |
qint64 & | reference, | ||
qint64 | defaultValue = 0 , |
||
const QString & | key = QString() |
||
) |
- Deprecated:
- Since 5.0, use addItemLongLong().
Definition at line 1395 of file kcoreconfigskeleton.cpp.
◆ addItemIntList()
KCoreConfigSkeleton::ItemIntList * KCoreConfigSkeleton::addItemIntList | ( | const QString & | name, |
QList< int > & | reference, | ||
const QList< int > & | defaultValue = QList<int>() , |
||
const QString & | key = QString() |
||
) |
Register an item of type QList<int>.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1467 of file kcoreconfigskeleton.cpp.
◆ addItemLongLong()
KCoreConfigSkeleton::ItemLongLong * KCoreConfigSkeleton::addItemLongLong | ( | const QString & | name, |
qint64 & | reference, | ||
qint64 | defaultValue = 0 , |
||
const QString & | key = QString() |
||
) |
Register an item of type qint64
.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1386 of file kcoreconfigskeleton.cpp.
◆ addItemPassword()
KCoreConfigSkeleton::ItemPassword * KCoreConfigSkeleton::addItemPassword | ( | const QString & | name, |
QString & | reference, | ||
const QString & | defaultValue = QLatin1String("") , |
||
const QString & | key = QString() |
||
) |
Register a password item of type QString.
The string value is written encrypted to the config file.
- Note
- The current encryption scheme is very weak.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1337 of file kcoreconfigskeleton.cpp.
◆ addItemPath()
KCoreConfigSkeleton::ItemPath * KCoreConfigSkeleton::addItemPath | ( | const QString & | name, |
QString & | reference, | ||
const QString & | defaultValue = QLatin1String("") , |
||
const QString & | key = QString() |
||
) |
Register a path item of type QString.
The string value is interpreted as a path. This means, dollar expansion is activated for this value, so that e.g. $HOME
gets expanded.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1345 of file kcoreconfigskeleton.cpp.
◆ addItemPoint()
KCoreConfigSkeleton::ItemPoint * KCoreConfigSkeleton::addItemPoint | ( | const QString & | name, |
QPoint & | reference, | ||
const QPoint & | defaultValue = QPoint() , |
||
const QString & | key = QString() |
||
) |
Register an item of type QPoint.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1432 of file kcoreconfigskeleton.cpp.
◆ addItemProperty()
KCoreConfigSkeleton::ItemProperty * KCoreConfigSkeleton::addItemProperty | ( | const QString & | name, |
QVariant & | reference, | ||
const QVariant & | defaultValue = QVariant() , |
||
const QString & | key = QString() |
||
) |
Register a property item of type QVariant.
- Note
- The following QVariant types are allowed: String, StringList, Font, Point, Rect, Size, Color, Int, UInt, Bool, Double, DateTime and Date.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1354 of file kcoreconfigskeleton.cpp.
◆ addItemRect()
KCoreConfigSkeleton::ItemRect * KCoreConfigSkeleton::addItemRect | ( | const QString & | name, |
QRect & | reference, | ||
const QRect & | defaultValue = QRect() , |
||
const QString & | key = QString() |
||
) |
Register an item of type QRect.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1424 of file kcoreconfigskeleton.cpp.
◆ addItemSize()
KCoreConfigSkeleton::ItemSize * KCoreConfigSkeleton::addItemSize | ( | const QString & | name, |
QSize & | reference, | ||
const QSize & | defaultValue = QSize() , |
||
const QString & | key = QString() |
||
) |
Register an item of type QSize.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1440 of file kcoreconfigskeleton.cpp.
◆ addItemString()
KCoreConfigSkeleton::ItemString * KCoreConfigSkeleton::addItemString | ( | const QString & | name, |
QString & | reference, | ||
const QString & | defaultValue = QLatin1String("") , |
||
const QString & | key = QString() |
||
) |
Register an item of type QString.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1328 of file kcoreconfigskeleton.cpp.
◆ addItemStringList()
KCoreConfigSkeleton::ItemStringList * KCoreConfigSkeleton::addItemStringList | ( | const QString & | name, |
QStringList & | reference, | ||
const QStringList & | defaultValue = QStringList() , |
||
const QString & | key = QString() |
||
) |
Register an item of type QStringList.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1458 of file kcoreconfigskeleton.cpp.
◆ addItemUInt()
KCoreConfigSkeleton::ItemUInt * KCoreConfigSkeleton::addItemUInt | ( | const QString & | name, |
quint32 & | reference, | ||
quint32 | defaultValue = 0 , |
||
const QString & | key = QString() |
||
) |
Register an item of type quint32
.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1378 of file kcoreconfigskeleton.cpp.
◆ addItemUInt64()
KCoreConfigSkeleton::ItemULongLong * KCoreConfigSkeleton::addItemUInt64 | ( | const QString & | name, |
quint64 & | reference, | ||
quint64 | defaultValue = 0 , |
||
const QString & | key = QString() |
||
) |
- Deprecated:
- Since 5.0, use addItemULongLong().
Definition at line 1410 of file kcoreconfigskeleton.cpp.
◆ addItemULongLong()
KCoreConfigSkeleton::ItemULongLong * KCoreConfigSkeleton::addItemULongLong | ( | const QString & | name, |
quint64 & | reference, | ||
quint64 | defaultValue = 0 , |
||
const QString & | key = QString() |
||
) |
Register an item of type quint64
.
- Parameters
-
name Name used to identify this setting. Names must be unique. reference Pointer to the variable, which is set by readConfig() calls and read by save() calls. defaultValue Default value, which is used when the config file does not yet contain the key of this item. key Key used in config file. If key
is a null string,name
is used as key.
- Returns
- The created item
Definition at line 1401 of file kcoreconfigskeleton.cpp.
◆ clearItems()
void KCoreConfigSkeleton::clearItems | ( | ) |
Removes and deletes all items.
Definition at line 1320 of file kcoreconfigskeleton.cpp.
◆ config() [1/2]
const KConfig * KCoreConfigSkeleton::config | ( | ) |
Return the KConfig object used for reading and writing the settings.
Definition at line 1156 of file kcoreconfigskeleton.cpp.
◆ config() [2/2]
const KConfig* KCoreConfigSkeleton::config | ( | ) | const |
Return the KConfig object used for reading and writing the settings.
◆ configChanged
|
signal |
This signal is emitted when the configuration change.
◆ currentGroup()
QString KCoreConfigSkeleton::currentGroup | ( | ) | const |
Returns the current group used for addItem() calls.
Definition at line 1151 of file kcoreconfigskeleton.cpp.
◆ findItem()
KConfigSkeletonItem * KCoreConfigSkeleton::findItem | ( | const QString & | name | ) | const |
◆ isDefaults()
bool KCoreConfigSkeleton::isDefaults | ( | ) | const |
Indicates if all the registered items are set to their default value.
- Since
- 5.64
Definition at line 1218 of file kcoreconfigskeleton.cpp.
◆ isImmutable()
bool KCoreConfigSkeleton::isImmutable | ( | const QString & | name | ) | const |
Return whether a certain item is immutable.
- Since
- 4.4
Definition at line 1475 of file kcoreconfigskeleton.cpp.
◆ isSaveNeeded()
bool KCoreConfigSkeleton::isSaveNeeded | ( | ) | const |
Indicates if any registered item has a different value than the previously loaded value.
- Since
- 5.64
Definition at line 1225 of file kcoreconfigskeleton.cpp.
◆ items()
KConfigSkeletonItem::List KCoreConfigSkeleton::items | ( | ) | const |
Return list of items managed by this KCoreConfigSkeleton object.
Definition at line 1176 of file kcoreconfigskeleton.cpp.
◆ load()
void KCoreConfigSkeleton::load | ( | ) |
Read preferences from config file.
All registered items are set to the values read from disk. This method calls usrRead() after reading the settings of the registered items from the KConfig. You can override usrRead() in derived classes if you have special requirements.
Definition at line 1204 of file kcoreconfigskeleton.cpp.
◆ read()
void KCoreConfigSkeleton::read | ( | ) |
Read preferences from the KConfig object.
This method assumes that the KConfig object was previously loaded, i.e. it uses the in-memory values from KConfig without reloading from disk.
This method calls usrRead() after reading the settings of the registered items from the KConfig. You can override usrRead() in derived classes if you have special requirements.
- Since
- 5.0
Definition at line 1210 of file kcoreconfigskeleton.cpp.
◆ readConfig()
|
inline |
- Deprecated:
- since 5.0, call load() instead (to reload from disk) or just read() if the underlying KConfig object is already up-to-date.
Definition at line 1166 of file kcoreconfigskeleton.h.
◆ removeItem()
void KCoreConfigSkeleton::removeItem | ( | const QString & | name | ) |
Removes and deletes an item by name.
- Parameters
-
name the name of the item to remove
Definition at line 1310 of file kcoreconfigskeleton.cpp.
◆ save
|
slot |
Write preferences to config file.
The values of all registered items are written to disk. This method calls usrSave() after writing the settings from the registered items to the KConfig. You can override usrSave() in derived classes if you have special requirements.
Definition at line 1232 of file kcoreconfigskeleton.cpp.
◆ setCurrentGroup()
void KCoreConfigSkeleton::setCurrentGroup | ( | const QString & | group | ) |
Set the config file group for subsequent addItem() calls.
It is valid until setCurrentGroup() is called with a new argument. Call this before you add any items. The default value is "No Group".
Definition at line 1146 of file kcoreconfigskeleton.cpp.
◆ setDefaults()
|
virtual |
Set all registered items to their default values.
This method calls usrSetDefaults() after setting the defaults for the registered items. You can override usrSetDefaults() in derived classes if you have special requirements. If you need more fine-grained control of setting the default values of the registered items you can override setDefaults() in a derived class.
Definition at line 1196 of file kcoreconfigskeleton.cpp.
◆ setSharedConfig()
void KCoreConfigSkeleton::setSharedConfig | ( | KSharedConfig::Ptr | pConfig | ) |
Set the KSharedConfig object used for reading and writing the settings.
Definition at line 1171 of file kcoreconfigskeleton.cpp.
◆ sharedConfig()
KSharedConfig::Ptr KCoreConfigSkeleton::sharedConfig | ( | ) | const |
Return the KConfig object used for reading and writing the settings.
- Since
- 5.0
Definition at line 1166 of file kcoreconfigskeleton.cpp.
◆ useDefaults()
|
virtual |
Specify whether this object should reflect the actual values or the default values.
This method is implemented by usrUseDefaults(), which can be overridden in derived classes if you have special requirements and can call usrUseDefaults() directly. If you don't have control whether useDefaults() or usrUseDefaults() is called override useDefaults() directly.
- Parameters
-
b true
to make this object reflect the default values,false
to make it reflect the actual values.
- Returns
- The state prior to this call
Definition at line 1181 of file kcoreconfigskeleton.cpp.
◆ usrRead()
|
protectedvirtual |
Perform the actual reading of the configuration file.
Override in derived classes to read special config values. Called from read()
Definition at line 1261 of file kcoreconfigskeleton.cpp.
◆ usrReadConfig()
|
protectedvirtual |
- Deprecated:
- since 5.0, override usrRead instead.
This method is still called from usrRead for compatibility.
Definition at line 1269 of file kcoreconfigskeleton.cpp.
◆ usrSave()
|
protectedvirtual |
Perform the actual writing of the configuration file.
Override in derived classes to write special config values. Called from save()
Definition at line 1274 of file kcoreconfigskeleton.cpp.
◆ usrSetDefaults()
|
protectedvirtual |
Perform the actual setting of default values.
Override in derived classes to set special default values. Called from setDefaults()
Definition at line 1257 of file kcoreconfigskeleton.cpp.
◆ usrUseDefaults()
|
protectedvirtual |
Implemented by subclasses that use special defaults.
It replaces the default values with the actual values and vice versa. Called from useDefaults()
- Parameters
-
b true
to make this object reflect the default values,false
to make it reflect the actual values.
- Returns
- The state prior to this call
Definition at line 1252 of file kcoreconfigskeleton.cpp.
◆ usrWriteConfig()
|
protectedvirtual |
- Deprecated:
- since 5.0, override usrSave instead.
This method is still called from usrSave for compatibility.
Reimplemented in KConfigLoader.
Definition at line 1284 of file kcoreconfigskeleton.cpp.
◆ writeConfig
|
inlineslot |
- Deprecated:
- since 5.0, call save() instead.
Definition at line 1537 of file kcoreconfigskeleton.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Dec 2 2023 04:11:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.