KConfig 5.109.0
|
A class for one specific group in a KConfig object. More...
#include <KConfigGroup>
Public Member Functions | |
KConfigGroup () | |
Constructs an invalid group. | |
KConfigGroup (const KConfigBase *master, const char *group) | |
Overload for KConfigGroup(const KConfigBase*,const QString&) | |
KConfigGroup (const KConfigBase *master, const QString &group) | |
Construct a read-only config group. | |
KConfigGroup (const KConfigGroup &) | |
Creates a copy of a group. | |
KConfigGroup (const QExplicitlySharedDataPointer< KSharedConfig > &master, const char *group) | |
Overload for KConfigGroup(const KConfigBase*,const QString&) | |
KConfigGroup (const QExplicitlySharedDataPointer< KSharedConfig > &master, const QString &group) | |
Overload for KConfigGroup(const KConfigBase*,const QString&) | |
KConfigGroup (KConfigBase *master, const char *group) | |
Overload for KConfigGroup(KConfigBase*,const QString&) | |
KConfigGroup (KConfigBase *master, const QString &group) | |
Construct a config group corresponding to group in master . | |
AccessMode | accessMode () const override |
void | changeGroup (const char *group) |
Overload for changeGroup(const QString&) | |
void | changeGroup (const QString &group) |
Changes the group of the object. | |
KConfig * | config () |
Return the config object that this group belongs to. | |
const KConfig * | config () const |
Return the config object that this group belongs to. | |
void | copyTo (KConfigBase *other, WriteConfigFlags pFlags=Normal) const |
Copies the entries in this group to another configuration object. | |
void | deleteEntry (const char *key, WriteConfigFlags pFlags=Normal) |
Overload for deleteEntry(const QString&, WriteConfigFlags) | |
void | deleteEntry (const QString &pKey, WriteConfigFlags pFlags=Normal) |
Deletes the entry specified by pKey in the current group. | |
void | deleteGroup (const char *group, WriteConfigFlags flags=Normal) |
Overload for deleteGroup(const QString&, WriteConfigFlags) | |
void | deleteGroup (const QByteArray &group, WriteConfigFlags flags=Normal) |
Overload for deleteGroup(const QString&, WriteConfigFlags) | |
void | deleteGroup (const QString &group, WriteConfigFlags flags=Normal) |
Delete group . | |
void | deleteGroup (WriteConfigFlags pFlags=Normal) |
Delete all entries in the entire group. | |
QMap< QString, QString > | entryMap () const |
Returns a map (tree) of entries for all entries in this group. | |
bool | exists () const |
Check whether the containing KConfig object actually contains a group with this name. | |
QStringList | groupList () const override |
bool | hasDefault (const char *key) const |
Overload for hasDefault(const QString&) const. | |
bool | hasDefault (const QString &key) const |
Whether a default is specified for an entry in either the system wide configuration file or the global KDE config file. | |
bool | hasKey (const char *key) const |
Overload for hasKey(const QString&) const. | |
bool | hasKey (const QString &key) const |
Checks whether the key has an entry in this group. | |
bool | isEntryImmutable (const char *key) const |
Overload for isEntryImmutable(const QString&) const. | |
bool | isEntryImmutable (const QString &key) const |
Checks if it is possible to change the given entry. | |
bool | isImmutable () const override |
Whether this group may be changed. | |
bool | isValid () const |
Whether the group is valid. | |
QStringList | keyList () const |
Returns a list of keys this group contains. | |
void | markAsClean () override |
void | moveValuesTo (const QList< const char * > &keys, KConfigGroup &other, WriteConfigFlags pFlags=Normal) |
Moves the key-value pairs from one config group to the other. | |
QString | name () const |
The name of this group. | |
KConfigGroup & | operator= (const KConfigGroup &) |
KConfigGroup | parent () const |
Returns the group that this group belongs to. | |
QString | readEntry (const char *key, const char *aDefault=nullptr) const |
Overload for readEntry(const QString&, const QString&) const. | |
template<typename T > | |
QList< T > | readEntry (const char *key, const QList< T > &aDefault) const |
Overload for readEntry<T>(const QString&, const QList<T>&) const. | |
QString | readEntry (const char *key, const QString &aDefault) const |
Overload for readEntry(const QString&, const QString&) const. | |
QStringList | readEntry (const char *key, const QStringList &aDefault) const |
Overload for readEntry(const QString&, const QStringList&) const. | |
QVariant | readEntry (const char *key, const QVariant &aDefault) const |
Overload for readEntry(const QString&, const QVariant&) const. | |
QVariantList | readEntry (const char *key, const QVariantList &aDefault) const |
Overload for readEntry(const QString&, const QVariantList&) const. | |
template<typename T > | |
T | readEntry (const char *key, const T &aDefault) const |
Overload for readEntry<T>(const QString&, const T&) const. | |
QString | readEntry (const QString &key, const char *aDefault=nullptr) const |
Overload for readEntry(const QString&, const QString&) const. | |
template<typename T > | |
QList< T > | readEntry (const QString &key, const QList< T > &aDefault) const |
Reads a list of values from the config object. | |
QString | readEntry (const QString &key, const QString &aDefault) const |
Reads the string value of an entry specified by key in the current group. | |
QStringList | readEntry (const QString &key, const QStringList &aDefault) const |
Reads a list of strings from the config object. | |
QVariant | readEntry (const QString &key, const QVariant &aDefault) const |
Reads the value of an entry specified by key in the current group. | |
QVariantList | readEntry (const QString &key, const QVariantList &aDefault) const |
template<typename T > | |
T | readEntry (const QString &key, const T &aDefault) const |
Reads the value of an entry specified by pKey in the current group. | |
QString | readEntryUntranslated (const char *key, const QString &aDefault=QString()) const |
Overload for readEntryUntranslated(const QString&, const QString&) const. | |
QString | readEntryUntranslated (const QString &pKey, const QString &aDefault=QString()) const |
Reads an untranslated string entry. | |
QString | readPathEntry (const char *key, const QString &aDefault) const |
Overload for readPathEntry(const QString&, const QString&) const. | |
QStringList | readPathEntry (const char *key, const QStringList &aDefault) const |
Overload for readPathEntry(const QString&, const QStringList&) const. | |
QString | readPathEntry (const QString &pKey, const QString &aDefault) const |
Reads a path. | |
QStringList | readPathEntry (const QString &pKey, const QStringList &aDefault) const |
Reads a list of paths. | |
QStringList | readXdgListEntry (const char *key, const QStringList &aDefault=QStringList()) const |
Overload for readXdgListEntry(const QString&, const QStringList&) const. | |
QStringList | readXdgListEntry (const QString &pKey, const QStringList &aDefault=QStringList()) const |
Reads a list of strings from the config object, following XDG desktop entry spec separator semantics. | |
void | reparent (KConfigBase *parent, WriteConfigFlags pFlags=Normal) |
Changes the configuration object that this group belongs to. | |
void | revertToDefault (const char *key) |
Overload for revertToDefault(const QString&) | |
void | revertToDefault (const char *key, WriteConfigFlags pFlag) |
Overload for revertToDefault(const QString&, WriteConfigFlags) | |
void | revertToDefault (const QString &key) |
Reverts an entry to the default settings. | |
void | revertToDefault (const QString &key, WriteConfigFlags pFlag) |
bool | sync () override |
void | writeEntry (const char *key, const char *value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
void | writeEntry (const char *key, const QByteArray &value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
template<typename T > | |
void | writeEntry (const char *key, const QList< T > &value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
void | writeEntry (const char *key, const QString &value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
void | writeEntry (const char *key, const QStringList &value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
void | writeEntry (const char *key, const QVariant &value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
void | writeEntry (const char *key, const QVariantList &value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
template<typename T > | |
void | writeEntry (const char *key, const T &value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
void | writeEntry (const QString &key, const char *value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
void | writeEntry (const QString &key, const QByteArray &value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
template<typename T > | |
void | writeEntry (const QString &key, const QList< T > &value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
void | writeEntry (const QString &key, const QString &value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
void | writeEntry (const QString &key, const QStringList &value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
void | writeEntry (const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal) |
Writes a value to the configuration object. | |
void | writeEntry (const QString &key, const QVariantList &value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
template<typename T > | |
void | writeEntry (const QString &key, const T &value, WriteConfigFlags pFlags=Normal) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags) | |
void | writePathEntry (const char *Key, const QString &path, WriteConfigFlags pFlags=Normal) |
Overload for writePathEntry(const QString&, const QString&, WriteConfigFlags) | |
void | writePathEntry (const char *key, const QStringList &value, WriteConfigFlags pFlags=Normal) |
Overload for writePathEntry(const QString&, const QStringList&, WriteConfigFlags) | |
void | writePathEntry (const QString &pKey, const QString &path, WriteConfigFlags pFlags=Normal) |
Writes a file path to the configuration. | |
void | writePathEntry (const QString &pKey, const QStringList &value, WriteConfigFlags pFlags=Normal) |
Writes a list of paths to the configuration. | |
void | writeXdgListEntry (const char *key, const QStringList &value, WriteConfigFlags pFlags=Normal) |
Overload for writeXdgListEntry(const QString&, const QStringList&, WriteConfigFlags) | |
void | writeXdgListEntry (const QString &pKey, const QStringList &value, WriteConfigFlags pFlags=Normal) |
Writes a list of strings to the config object, following XDG desktop entry spec separator semantics. | |
![]() | |
virtual | ~KConfigBase () |
Destructs the KConfigBase object. | |
virtual AccessMode | accessMode () const =0 |
Returns the access mode of the app-config object. | |
void | deleteGroup (const char *group, WriteConfigFlags flags=Normal) |
Overload for deleteGroup(const QString&, WriteConfigFlags) | |
void | deleteGroup (const QByteArray &group, WriteConfigFlags flags=Normal) |
Overload for deleteGroup(const QString&, WriteConfigFlags) | |
void | deleteGroup (const QString &group, WriteConfigFlags flags=Normal) |
Delete group . | |
KConfigGroup | group (const char *group) |
Overload for group(const QString&) | |
const KConfigGroup | group (const char *group) const |
Const overload for group(const QString&) | |
KConfigGroup | group (const QByteArray &group) |
Overload for group(const QString&) | |
const KConfigGroup | group (const QByteArray &group) const |
Const overload for group(const QString&) | |
KConfigGroup | group (const QString &group) |
Returns an object for the named subgroup. | |
const KConfigGroup | group (const QString &group) const |
Const overload for group(const QString&) | |
virtual QStringList | groupList () const =0 |
Returns a list of groups that are known about. | |
bool | hasGroup (const char *group) const |
Overload for hasGroup(const QString&) const. | |
bool | hasGroup (const QByteArray &group) const |
Overload for hasGroup(const QString&) const. | |
bool | hasGroup (const QString &group) const |
Returns true if the specified group is known about. | |
bool | isGroupImmutable (const char *group) const |
Overload for isGroupImmutable(const QString&) const. | |
bool | isGroupImmutable (const QByteArray &group) const |
Overload for isGroupImmutable(const QString&) const. | |
bool | isGroupImmutable (const QString &group) const |
Can changes be made to the entries in group ? | |
virtual bool | isImmutable () const =0 |
Checks whether this configuration object can be modified. | |
virtual void | markAsClean ()=0 |
Reset the dirty flags of all entries in the entry map, so the values will not be written to disk on a later call to sync(). | |
virtual bool | sync ()=0 |
Syncs the configuration object that this group belongs to. | |
Protected Member Functions | |
void | deleteGroupImpl (const QByteArray &group, WriteConfigFlags flags) override |
const KConfigGroup | groupImpl (const QByteArray &b) const override |
KConfigGroup | groupImpl (const QByteArray &b) override |
bool | hasGroupImpl (const QByteArray &group) const override |
bool | isGroupImmutableImpl (const QByteArray &aGroup) const override |
![]() | |
virtual void | deleteGroupImpl (const QByteArray &group, WriteConfigFlags flags=Normal)=0 |
virtual const KConfigGroup | groupImpl (const QByteArray &group) const =0 |
virtual KConfigGroup | groupImpl (const QByteArray &group)=0 |
virtual bool | hasGroupImpl (const QByteArray &group) const =0 |
virtual bool | isGroupImmutableImpl (const QByteArray &group) const =0 |
virtual void | virtual_hook (int id, void *data) |
Virtual hook, used to add new "virtual" functions while maintaining binary compatibility. | |
Additional Inherited Members | |
![]() | |
enum | AccessMode { NoAccess , ReadOnly , ReadWrite } |
Possible return values for accessMode(). More... | |
enum | WriteConfigFlag { Persistent = 0x01 , Global = 0x02 , Localized = 0x04 , Notify = 0x08 | Persistent , Normal = Persistent } |
Flags to control write entry. More... | |
typedef QFlags< WriteConfigFlag > | WriteConfigFlags |
Stores a combination of #WriteConfigFlag values. | |
A class for one specific group in a KConfig object.
If you want to access the top-level entries of a KConfig object, which are not associated with any group, use an empty group name.
A KConfigGroup will be read-only if it is constructed from a const config object or from another read-only group.
KConfigGroup::KConfigGroup | ( | ) |
Constructs an invalid group.
KConfigGroup::KConfigGroup | ( | KConfigBase * | master, |
const QString & | group | ||
) |
Construct a config group corresponding to group
in master
.
This allows the creation of subgroups by passing another group as master
.
group | name of group |
KConfigGroup::KConfigGroup | ( | KConfigBase * | master, |
const char * | group | ||
) |
Overload for KConfigGroup(KConfigBase*,const QString&)
group | name of group, encoded in UTF-8 |
KConfigGroup::KConfigGroup | ( | const KConfigBase * | master, |
const QString & | group | ||
) |
Construct a read-only config group.
A read-only group will silently ignore any attempts to write to it.
This allows the creation of subgroups by passing an existing group as master
.
KConfigGroup::KConfigGroup | ( | const KConfigBase * | master, |
const char * | group | ||
) |
Overload for KConfigGroup(const KConfigBase*,const QString&)
group | name of group, encoded in UTF-8 |
KConfigGroup::KConfigGroup | ( | const QExplicitlySharedDataPointer< KSharedConfig > & | master, |
const QString & | group | ||
) |
Overload for KConfigGroup(const KConfigBase*,const QString&)
KConfigGroup::KConfigGroup | ( | const QExplicitlySharedDataPointer< KSharedConfig > & | master, |
const char * | group | ||
) |
Overload for KConfigGroup(const KConfigBase*,const QString&)
group | name of group, encoded in UTF-8 |
KConfigGroup::KConfigGroup | ( | const KConfigGroup & | ) |
Creates a copy of a group.
|
overridevirtual |
Implements KConfigBase.
void KConfigGroup::changeGroup | ( | const char * | group | ) |
Overload for changeGroup(const QString&)
group | name of group, encoded in UTF-8 |
void KConfigGroup::changeGroup | ( | const QString & | group | ) |
Changes the group of the object.
KConfig * KConfigGroup::config | ( | ) |
Return the config object that this group belongs to.
const KConfig * KConfigGroup::config | ( | ) | const |
Return the config object that this group belongs to.
void KConfigGroup::copyTo | ( | KConfigBase * | other, |
WriteConfigFlags | pFlags = Normal |
||
) | const |
Copies the entries in this group to another configuration object.
other
can be either another group or a different file.other | the configuration object to copy this group's entries to |
pFlags | the flags to use when writing the entries to the other configuration object |
void KConfigGroup::deleteEntry | ( | const char * | key, |
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for deleteEntry(const QString&, WriteConfigFlags)
key | name of key, encoded in UTF-8 |
void KConfigGroup::deleteEntry | ( | const QString & | pKey, |
WriteConfigFlags | pFlags = Normal |
||
) |
Deletes the entry specified by pKey
in the current group.
This also hides system wide defaults.
pKey | the key to delete |
pFlags | the flags to use when deleting this entry |
void KConfigBase::deleteGroup | ( | const char * | group, |
WriteConfigFlags | flags = Normal |
||
) |
Overload for deleteGroup(const QString&, WriteConfigFlags)
group | name of group to delete, encoded in UTF-8 |
void KConfigBase::deleteGroup | ( | const QByteArray & | group, |
WriteConfigFlags | flags = Normal |
||
) |
Overload for deleteGroup(const QString&, WriteConfigFlags)
group | name of group to delete, encoded in UTF-8 |
void KConfigBase::deleteGroup | ( | const QString & | group, |
WriteConfigFlags | flags = Normal |
||
) |
Delete group
.
This marks group
as deleted in the config object. This effectively removes any cascaded values from config files earlier in the stack.
void KConfigGroup::deleteGroup | ( | WriteConfigFlags | pFlags = Normal | ) |
Delete all entries in the entire group.
pFlags | flags passed to KConfig::deleteGroup |
|
overrideprotectedvirtual |
group | name of group, encoded in UTF-8 |
Implements KConfigBase.
QMap< QString, QString > KConfigGroup::entryMap | ( | ) | const |
Returns a map (tree) of entries for all entries in this group.
Only the actual entry string is returned, none of the other internal data should be included.
bool KConfigGroup::exists | ( | ) | const |
Check whether the containing KConfig object actually contains a group with this name.
|
overrideprotectedvirtual |
group | name of group, encoded in UTF-8 |
Implements KConfigBase.
|
overrideprotectedvirtual |
group | name of group, encoded in UTF-8 |
Implements KConfigBase.
|
overridevirtual |
Implements KConfigBase.
bool KConfigGroup::hasDefault | ( | const char * | key | ) | const |
Overload for hasDefault(const QString&) const.
key | name of key, encoded in UTF-8 |
bool KConfigGroup::hasDefault | ( | const QString & | key | ) | const |
Whether a default is specified for an entry in either the system wide configuration file or the global KDE config file.
If an application computes a default value at runtime for a certain entry, e.g. like:
then it may wish to make the following check before writing back changes:
This ensures that as long as the entry is not modified to differ from the computed default, the application will keep using the computed default and will follow changes the computed default makes over time.
key | the key of the entry to check |
true
if the global or system settings files specify a default for key
in this group, false
otherwise
|
overrideprotectedvirtual |
group | name of group, encoded in UTF-8 |
Implements KConfigBase.
bool KConfigGroup::hasKey | ( | const char * | key | ) | const |
Overload for hasKey(const QString&) const.
key | name of key, encoded in UTF-8 |
bool KConfigGroup::hasKey | ( | const QString & | key | ) | const |
Checks whether the key has an entry in this group.
Use this to determine if a key is not specified for the current group (hasKey() returns false).
If this returns false
for a key, readEntry() (and its variants) will return the default value passed to them.
key | the key to search for |
true
if the key is defined in this group by any of the configuration sources, false
otherwisebool KConfigGroup::isEntryImmutable | ( | const char * | key | ) | const |
Overload for isEntryImmutable(const QString&) const.
key | name of key, encoded in UTF-8 |
bool KConfigGroup::isEntryImmutable | ( | const QString & | key | ) | const |
Checks if it is possible to change the given entry.
If isImmutable() returns true
, then this method will return true
for all inputs.
key | the key to check |
false
if the key may be changed using this configuration group object, true
otherwise
|
overrideprotectedvirtual |
group | name of group, encoded in UTF-8 |
Implements KConfigBase.
|
overridevirtual |
Whether this group may be changed.
false
if the group may be changed, true
otherwise Implements KConfigBase.
bool KConfigGroup::isValid | ( | ) | const |
Whether the group is valid.
A group is invalid if it was constructed without arguments.
You should not call any functions on an invalid group.
true
if the group is valid, false
if it is invalid. QStringList KConfigGroup::keyList | ( | ) | const |
Returns a list of keys this group contains.
|
overridevirtual |
Implements KConfigBase.
void KConfigGroup::moveValuesTo | ( | const QList< const char * > & | keys, |
KConfigGroup & | other, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Moves the key-value pairs from one config group to the other.
In case the entries do not exist the key is ignored.
QString KConfigGroup::name | ( | ) | const |
The name of this group.
The root group is named "<default>".
KConfigGroup KConfigGroup::parent | ( | ) | const |
Returns the group that this group belongs to.
QString KConfigGroup::readEntry | ( | const char * | key, |
const char * | aDefault = nullptr |
||
) | const |
Overload for readEntry(const QString&, const QString&) const.
key | name of key, encoded in UTF-8 |
QList< T > KConfigGroup::readEntry | ( | const char * | key, |
const QList< T > & | aDefault | ||
) | const |
Overload for readEntry<T>(const QString&, const QList<T>&) const.
key | name of key, encoded in UTF-8 |
QString KConfigGroup::readEntry | ( | const char * | key, |
const QString & | aDefault | ||
) | const |
Overload for readEntry(const QString&, const QString&) const.
key | name of key, encoded in UTF-8 |
QStringList KConfigGroup::readEntry | ( | const char * | key, |
const QStringList & | aDefault | ||
) | const |
Overload for readEntry(const QString&, const QStringList&) const.
key | name of key, encoded in UTF-8 |
QVariant KConfigGroup::readEntry | ( | const char * | key, |
const QVariant & | aDefault | ||
) | const |
Overload for readEntry(const QString&, const QVariant&) const.
key | name of key, encoded in UTF-8 |
QVariantList KConfigGroup::readEntry | ( | const char * | key, |
const QVariantList & | aDefault | ||
) | const |
Overload for readEntry(const QString&, const QVariantList&) const.
key | name of key, encoded in UTF-8 |
T KConfigGroup::readEntry | ( | const char * | key, |
const T & | aDefault | ||
) | const |
Overload for readEntry<T>(const QString&, const T&) const.
key | name of key, encoded in UTF-8 |
QString KConfigGroup::readEntry | ( | const QString & | key, |
const char * | aDefault = nullptr |
||
) | const |
Overload for readEntry(const QString&, const QString&) const.
|
inline |
Reads a list of values from the config object.
key | the key to search for |
aDefault | the default value to use if the key does not exist |
aDefault
if key
does not existQString KConfigGroup::readEntry | ( | const QString & | key, |
const QString & | aDefault | ||
) | const |
Reads the string value of an entry specified by key
in the current group.
If you want to read a path, please use readPathEntry().
key | the key to search for |
aDefault | a default value returned if the key was not found |
aDefault
if the key was not foundQStringList KConfigGroup::readEntry | ( | const QString & | key, |
const QStringList & | aDefault | ||
) | const |
Reads a list of strings from the config object.
key | The key to search for |
aDefault | The default value to use if the key does not exist |
aDefault
if key
does not existQVariant KConfigGroup::readEntry | ( | const QString & | key, |
const QVariant & | aDefault | ||
) | const |
Reads the value of an entry specified by key
in the current group.
key | the key to search for |
aDefault | a default value returned if the key was not found |
aDefault
if the key was not foundQVariantList KConfigGroup::readEntry | ( | const QString & | key, |
const QVariantList & | aDefault | ||
) | const |
|
inline |
Reads the value of an entry specified by pKey
in the current group.
This template method makes it possible to write QString foo = readEntry("...", QString("default")); and the same with all other types supported by QVariant.
The return type of the method is simply the same as the type of the default value.
key | The key to search for |
aDefault | A default value returned if the key was not found |
aDefault
.QString KConfigGroup::readEntryUntranslated | ( | const char * | key, |
const QString & | aDefault = QString() |
||
) | const |
Overload for readEntryUntranslated(const QString&, const QString&) const.
key | name of key, encoded in UTF-8 |
QString KConfigGroup::readEntryUntranslated | ( | const QString & | pKey, |
const QString & | aDefault = QString() |
||
) | const |
Reads an untranslated string entry.
You should not normally need to use this.
pKey | the key to search for |
aDefault | a default value returned if the key was not found |
aDefault
if the key does not exist QString KConfigGroup::readPathEntry | ( | const char * | key, |
const QString & | aDefault | ||
) | const |
Overload for readPathEntry(const QString&, const QString&) const.
key | name of key, encoded in UTF-8 |
QStringList KConfigGroup::readPathEntry | ( | const char * | key, |
const QStringList & | aDefault | ||
) | const |
Overload for readPathEntry(const QString&, const QStringList&) const.
key | name of key, encoded in UTF-8 |
QString KConfigGroup::readPathEntry | ( | const QString & | pKey, |
const QString & | aDefault | ||
) | const |
Reads a path.
Read the value of an entry specified by pKey
in the current group and interpret it as a path. This means, dollar expansion is activated for this value, so that e.g. $HOME gets expanded.
pKey | The key to search for. |
aDefault | A default value returned if the key was not found. |
aDefault
is null. QStringList KConfigGroup::readPathEntry | ( | const QString & | pKey, |
const QStringList & | aDefault | ||
) | const |
Reads a list of paths.
Read the value of an entry specified by pKey
in the current group and interpret it as a list of paths. This means, dollar expansion is activated for this value, so that e.g. $HOME gets expanded.
pKey | the key to search for |
aDefault | a default value returned if the key was not found |
aDefault
if the key does not exist QStringList KConfigGroup::readXdgListEntry | ( | const char * | key, |
const QStringList & | aDefault = QStringList() |
||
) | const |
Overload for readXdgListEntry(const QString&, const QStringList&) const.
key | name of key, encoded in UTF-8 |
QStringList KConfigGroup::readXdgListEntry | ( | const QString & | pKey, |
const QStringList & | aDefault = QStringList() |
||
) | const |
Reads a list of strings from the config object, following XDG desktop entry spec separator semantics.
pKey | the key to search for |
aDefault | the default value to use if the key does not exist |
aDefault
if pKey
does not existvoid KConfigGroup::reparent | ( | KConfigBase * | parent, |
WriteConfigFlags | pFlags = Normal |
||
) |
Changes the configuration object that this group belongs to.
other
can be another group, the top-level KConfig object or a different KConfig object entirely.If parent
is already the parent of this group, this method will have no effect.
parent | the config object to place this group under |
pFlags | the flags to use in determining which storage source to write the data to |
void KConfigGroup::revertToDefault | ( | const char * | key | ) |
Overload for revertToDefault(const QString&)
key | name of key, encoded in UTF-8 |
void KConfigGroup::revertToDefault | ( | const char * | key, |
WriteConfigFlags | pFlag | ||
) |
Overload for revertToDefault(const QString&, WriteConfigFlags)
key | name of key, encoded in UTF-8 |
void KConfigGroup::revertToDefault | ( | const QString & | key | ) |
Reverts an entry to the default settings.
Reverts the entry with key key
in the current group in the application specific config file to either the system wide (default) value or the value specified in the global KDE config file.
To revert entries in the global KDE config file, the global KDE config file should be opened explicitly in a separate config object.
key | The key of the entry to revert. |
|
overridevirtual |
void KConfigGroup::writeEntry | ( | const char * | key, |
const char * | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
key | name of key, encoded in UTF-8 |
void KConfigGroup::writeEntry | ( | const char * | key, |
const QByteArray & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
key | name of key, encoded in UTF-8 |
void KConfigGroup::writeEntry | ( | const char * | key, |
const QList< T > & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
key | name of key, encoded in UTF-8 |
void KConfigGroup::writeEntry | ( | const char * | key, |
const QString & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
key | name of key, encoded in UTF-8 |
void KConfigGroup::writeEntry | ( | const char * | key, |
const QStringList & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
key | name of key, encoded in UTF-8 |
void KConfigGroup::writeEntry | ( | const char * | key, |
const QVariant & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
key | name of key, encoded in UTF-8 |
void KConfigGroup::writeEntry | ( | const char * | key, |
const QVariantList & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
key | name of key, encoded in UTF-8 |
void KConfigGroup::writeEntry | ( | const char * | key, |
const T & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
key | name of key, encoded in UTF-8 |
void KConfigGroup::writeEntry | ( | const QString & | key, |
const char * | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
void KConfigGroup::writeEntry | ( | const QString & | key, |
const QByteArray & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
|
inline |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
void KConfigGroup::writeEntry | ( | const QString & | key, |
const QString & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
void KConfigGroup::writeEntry | ( | const QString & | key, |
const QStringList & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
void KConfigGroup::writeEntry | ( | const QString & | key, |
const QVariant & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Writes a value to the configuration object.
key | the key to write to |
value | the value to write |
pFlags | the flags to use when writing this entry |
void KConfigGroup::writeEntry | ( | const QString & | key, |
const QVariantList & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
|
inline |
Overload for writeEntry(const QString&, const QVariant&, WriteConfigFlags)
void KConfigGroup::writePathEntry | ( | const char * | Key, |
const QString & | path, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writePathEntry(const QString&, const QString&, WriteConfigFlags)
key | name of key, encoded in UTF-8 |
void KConfigGroup::writePathEntry | ( | const char * | key, |
const QStringList & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writePathEntry(const QString&, const QStringList&, WriteConfigFlags)
key | name of key, encoded in UTF-8 |
void KConfigGroup::writePathEntry | ( | const QString & | pKey, |
const QString & | path, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Writes a file path to the configuration.
If the path is located under $HOME, the user's home directory is replaced with $HOME in the persistent storage. The path should therefore be read back with readPathEntry()
pKey | the key to write to |
path | the path to write |
pFlags | the flags to use when writing this entry |
void KConfigGroup::writePathEntry | ( | const QString & | pKey, |
const QStringList & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Writes a list of paths to the configuration.
If any of the paths are located under $HOME, the user's home directory is replaced with $HOME in the persistent storage. The paths should therefore be read back with readPathEntry()
pKey | the key to write to |
value | the list to write |
pFlags | the flags to use when writing this entry |
void KConfigGroup::writeXdgListEntry | ( | const char * | key, |
const QStringList & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Overload for writeXdgListEntry(const QString&, const QStringList&, WriteConfigFlags)
key | name of key, encoded in UTF-8 |
void KConfigGroup::writeXdgListEntry | ( | const QString & | pKey, |
const QStringList & | value, | ||
WriteConfigFlags | pFlags = Normal |
||
) |
Writes a list of strings to the config object, following XDG desktop entry spec separator semantics.
pKey | the key to write to |
value | the list to write |
pFlags | the flags to use when writing this entry |