KConfigSkeletonItem Class

Class for storing a preferences setting. More...

Header: #include <KCoreConfigSkeleton>
CMake: find_package(KF6 REQUIRED COMPONENTS Config)
target_link_libraries(mytarget PRIVATE KF6::ConfigCore)
Inherited By:

KConfigSkeletonGenericItem and KPropertySkeletonItem

Public Types

Public Functions

KConfigSkeletonItem(const QString &_group, const QString &_key)
(since 5.68) KConfigGroup configGroup(KConfig *config) const
(since 5.74) QVariant getDefault() const
QString group() const
(since 5.64) bool isDefault() const
virtual bool isEqual(const QVariant &p) const = 0
bool isImmutable() const
(since 5.64) bool isSaveNeeded() const
QString key() const
QString label() const
virtual QVariant maxValue() const
virtual QVariant minValue() const
QString name() const
virtual QVariant property() const = 0
virtual void readConfig(KConfig *) = 0
virtual void readDefault(KConfig *) = 0
virtual void setDefault() = 0
(since 5.68) void setGroup(const KConfigGroup &cg)
void setGroup(const QString &_group)
void setKey(const QString &_key)
void setLabel(const QString &l)
void setName(const QString &_name)
virtual void setProperty(const QVariant &p) = 0
(since 4.2) void setToolTip(const QString &t)
void setWhatsThis(const QString &w)
(since 5.58) void setWriteFlags(KConfigBase::WriteConfigFlags flags)
virtual void swapDefault() = 0
(since 4.2) QString toolTip() const
QString whatsThis() const
virtual void writeConfig(KConfig *) = 0
(since 5.58) KConfigBase::WriteConfigFlags writeFlags() const

Protected Functions

void readImmutability(const KConfigGroup &group)

Detailed Description

This class represents one preferences setting as used by KCoreConfigSkeleton. Subclasses of KConfigSkeletonItem implement storage functions for a certain type of setting. Normally you don't have to use this class directly. Use the special addItem() functions of KCoreConfigSkeleton instead. If you subclass this class you will have to register instances with the function KCoreConfigSkeleton::addItem().

See also KCoreConfigSkeleton.

Member Type Documentation

KConfigSkeletonItem::Dict

KConfigSkeletonItem::DictIterator

KConfigSkeletonItem::List

Member Function Documentation

KConfigSkeletonItem::KConfigSkeletonItem(const QString &_group, const QString &_key)

Constructor.

_group Config file group.

_key Config file key.

[since 5.68] KConfigGroup KConfigSkeletonItem::configGroup(KConfig *config) const

Return a KConfigGroup, the one provided by setGroup(const KConfigGroup&) if it's valid, or make one from config and item's group.

This function was introduced in 5.68.

See also setGroup().

[since 5.74] QVariant KConfigSkeletonItem::getDefault() const

Returns the default value

This function was introduced in 5.74.

QString KConfigSkeletonItem::group() const

Return name of config file group.

See also setGroup().

[since 5.64] bool KConfigSkeletonItem::isDefault() const

Indicates if the item is set to its default value.

This function was introduced in 5.64.

[pure virtual] bool KConfigSkeletonItem::isEqual(const QVariant &p) const

Check whether the item is equal to p.

Use this function to compare items that use custom types, because QVariant::operator== will not work for those.

p QVariant to compare to

Returns true if the item is equal to p, false otherwise

bool KConfigSkeletonItem::isImmutable() const

Return if the entry can be modified.

[since 5.64] bool KConfigSkeletonItem::isSaveNeeded() const

Indicates if the item has a different value than the previously loaded value.

This function was introduced in 5.64.

QString KConfigSkeletonItem::key() const

Return config file key.

See also setKey().

QString KConfigSkeletonItem::label() const

Return the label of the item.

See also setLabel().

[virtual] QVariant KConfigSkeletonItem::maxValue() const

Return maximum value of item or invalid if not specified

[virtual] QVariant KConfigSkeletonItem::minValue() const

Return minimum value of item or invalid if not specified

QString KConfigSkeletonItem::name() const

Return internal name of entry.

See also setName().

[pure virtual] QVariant KConfigSkeletonItem::property() const

Return item as property

See also setProperty().

[pure virtual] void KConfigSkeletonItem::readConfig(KConfig *)

This function is called by KCoreConfigSkeleton to read the value for this setting from a config file.

[pure virtual] void KConfigSkeletonItem::readDefault(KConfig *)

Read global default value.

[protected] void KConfigSkeletonItem::readImmutability(const KConfigGroup &group)

Sets mIsImmutable to true if mKey in config is immutable.

group KConfigGroup to check if mKey is immutable in

[pure virtual] void KConfigSkeletonItem::setDefault()

Sets the current value to the default value.

See also isDefault().

[since 5.68] void KConfigSkeletonItem::setGroup(const KConfigGroup &cg)

Set config file group but giving the KConfigGroup.

Allow the item to be in nested groups.

This function was introduced in 5.68.

See also group().

void KConfigSkeletonItem::setGroup(const QString &_group)

Set config file group.

void KConfigSkeletonItem::setKey(const QString &_key)

Set config file key.

See also key().

void KConfigSkeletonItem::setLabel(const QString &l)

Set label providing a translated one-line description of the item.

See also label().

void KConfigSkeletonItem::setName(const QString &_name)

Set internal name of entry.

See also name().

[pure virtual] void KConfigSkeletonItem::setProperty(const QVariant &p)

Set item to p

See also property().

[since 4.2] void KConfigSkeletonItem::setToolTip(const QString &t)

Set ToolTip description of item.

This function was introduced in 4.2.

See also toolTip().

void KConfigSkeletonItem::setWhatsThis(const QString &w)

Set WhatsThis description of item.

See also whatsThis().

[since 5.58] void KConfigSkeletonItem::setWriteFlags(KConfigBase::WriteConfigFlags flags)

The write flags to be used when writing configuration.

This function was introduced in 5.58.

See also writeFlags().

[pure virtual] void KConfigSkeletonItem::swapDefault()

Exchanges the current value with the default value Used by KCoreConfigSkeleton::useDefaults(bool);

[since 4.2] QString KConfigSkeletonItem::toolTip() const

Return ToolTip description of item.

This function was introduced in 4.2.

See also setToolTip().

QString KConfigSkeletonItem::whatsThis() const

Return WhatsThis description of item.

See also setWhatsThis().

[pure virtual] void KConfigSkeletonItem::writeConfig(KConfig *)

This function is called by KCoreConfigSkeleton to write the value of this setting to a config file. Make sure to pass writeFlags() to every call of KConfigGroup::writeEntry() and KConfigGroup::revertToDefault().

[since 5.58] KConfigBase::WriteConfigFlags KConfigSkeletonItem::writeFlags() const

Return write flags to be used when writing configuration.

They should be passed to every call of KConfigGroup::writeEntry() and KConfigGroup::revertToDefault().

This function was introduced in 5.58.

See also setWriteFlags().