KPropertySkeletonItem Class

Class for proxying a QObject property as a preferences setting. More...

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

Public Functions

KPropertySkeletonItem(QObject *object, const QByteArray &propertyName, const QVariant &defaultValue)
void setNotifyFunction(const std::function<void ()> &impl)

Detailed Description

This class represents one preferences setting as used by KCoreConfigSkeleton. Unlike other KConfigSkeletonItem subclasses, this one won't store the preference in KConfig but will use a QObject property as storage, allowing to implement callbacks to run when a configuration property changes. You will have to register instances of this class with the function KCoreConfigSkeleton::addItem().

See also KConfigSkeletonItem.

Member Function Documentation

KPropertySkeletonItem::KPropertySkeletonItem(QObject *object, const QByteArray &propertyName, const QVariant &defaultValue)

Constructs a property skeleton item instance that allows to manage the propertyName and the property's defaultValue present in a QObject object.

void KPropertySkeletonItem::setNotifyFunction(const std::function<void ()> &impl)

Sets a notify function impl that will be invoked when the value of the property changes.