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: |
Public Types
Public Functions
| KConfigSkeletonItem(const QString &_group, const QString &_key) | |
| KConfigGroup | configGroup(KConfig *config) const |
| QVariant | getDefault() const |
| QString | group() const |
| bool | isDefault() const |
| virtual bool | isEqual(const QVariant &p) const = 0 |
| bool | isImmutable() const |
| 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 |
| 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 |
| void | setToolTip(const QString &t) |
| void | setWhatsThis(const QString &w) |
| void | setWriteFlags(KConfigBase::WriteConfigFlags flags) |
| virtual void | swapDefault() = 0 |
| QString | toolTip() const |
| QString | whatsThis() const |
| virtual void | writeConfig(KConfig *) = 0 |
| 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)
Constructs a skeleton item instance with the given Config file _group and _key.
KConfigGroup KConfigSkeletonItem::configGroup(KConfig *config) const
Returns a KConfigGroup, the one provided by setGroup(const KConfigGroup&) if it's valid, or make one from config and item's group.
See also setGroup().
QVariant KConfigSkeletonItem::getDefault() const
Returns the default value.
QString KConfigSkeletonItem::group() const
Returns the name of the config file group.
See also setGroup().
bool KConfigSkeletonItem::isDefault() const
Returns if this item is set to its default value.
[pure virtual] bool KConfigSkeletonItem::isEqual(const QVariant &p) const
Checks 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.
Returns true if the item is equal to p, false otherwise
bool KConfigSkeletonItem::isImmutable() const
Returns if the entry can be modified.
bool KConfigSkeletonItem::isSaveNeeded() const
Returns if the item has a different value than the previously loaded value.
QString KConfigSkeletonItem::key() const
Returns the config file key.
See also setKey().
QString KConfigSkeletonItem::label() const
Returns the label of the item.
See also setLabel().
[virtual] QVariant KConfigSkeletonItem::maxValue() const
Returns the maximum value of this item or invalid if not specified.
[virtual] QVariant KConfigSkeletonItem::minValue() const
Returns the minimum value of this item or invalid if not specified.
QString KConfigSkeletonItem::name() const
Returns the internal name of the settings entry.
See also setName().
[pure virtual] QVariant KConfigSkeletonItem::property() const
Returns this item as a 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 *)
Reads the 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().
void KConfigSkeletonItem::setGroup(const KConfigGroup &cg)
Sets a config file group by giving the KConfigGroup cg.
Allow the item to be in nested groups.
See also group().
void KConfigSkeletonItem::setGroup(const QString &_group)
Sets the config file _group.
void KConfigSkeletonItem::setKey(const QString &_key)
Sets the config file _key.
See also key().
void KConfigSkeletonItem::setLabel(const QString &l)
Sets the label l providing a translated one-line description of the item.
See also label().
void KConfigSkeletonItem::setName(const QString &_name)
Sets the internal name of the settings entry with the given _name.
See also name().
[pure virtual] void KConfigSkeletonItem::setProperty(const QVariant &p)
Sets the settings item to the property p.
See also property().
void KConfigSkeletonItem::setToolTip(const QString &t)
Sets the ToolTip t description of this item.
See also toolTip().
void KConfigSkeletonItem::setWhatsThis(const QString &w)
Sets WhatsThis description w of this item.
See also whatsThis().
void KConfigSkeletonItem::setWriteFlags(KConfigBase::WriteConfigFlags flags)
Sets the write flags to be used when writing the configuration.
See also writeFlags(), KConfigBase::WriteConfigFlags, and KConfigWatcher.
[pure virtual] void KConfigSkeletonItem::swapDefault()
Exchanges the current value with the default value.
Used by KCoreConfigSkeleton::useDefaults(bool).
QString KConfigSkeletonItem::toolTip() const
Returns the ToolTip description of this item.
See also setToolTip().
QString KConfigSkeletonItem::whatsThis() const
Returns the 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().
KConfigBase::WriteConfigFlags KConfigSkeletonItem::writeFlags() const
Returns write flags to be used when writing the configuration.
They should be passed to every call of KConfigGroup::writeEntry() and KConfigGroup::revertToDefault().
See also setWriteFlags().