KConfigSkeleton Class

Class for handling preferences settings for an application. More...

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

KConfigLoader

Public Types

class ItemColor
class ItemFont

Public Functions

KConfigSkeleton(KSharedConfig::Ptr config, QObject *parent = nullptr)
KConfigSkeleton(const QString &configname = QString(), QObject *parent = nullptr)
KConfigSkeleton::ItemColor *addItemColor(const QString &name, QColor &reference, const QColor &defaultValue = QColor(128, 128, 128), const QString &key = QString())
KConfigSkeleton::ItemFont *addItemFont(const QString &name, QFont &reference, const QFont &defaultValue = QFont(), const QString &key = QString())

Detailed Description

This class extends KCoreConfigSkeleton by support for GUI types.

Member Function Documentation

[explicit] KConfigSkeleton::KConfigSkeleton(KSharedConfig::Ptr config, QObject *parent = nullptr)

Constructor.

config configuration object to use.

[explicit] KConfigSkeleton::KConfigSkeleton(const QString &configname = QString(), QObject *parent = nullptr)

Constructor.

configname name of config file. If no name is given, the default config file as returned by KSharedConfig::openConfig() is used.

KConfigSkeleton::ItemColor *KConfigSkeleton::addItemColor(const QString &name, QColor &reference, const QColor &defaultValue = QColor(128, 128, 128), const QString &key = QString())

Register an item of type QColor.

name Name used to identify this setting. Names must be unique.

reference Pointer to the variable, which is set by read() 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

KConfigSkeleton::ItemFont *KConfigSkeleton::addItemFont(const QString &name, QFont &reference, const QFont &defaultValue = QFont(), const QString &key = QString())

Register an item of type QFont.

name Name used to identify this setting. Names must be unique.

reference Pointer to the variable, which is set by read() 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