Pages
API Documentation
On this page

KConfigWatcher Class

Watches for configuration changes. More...

  • Header: #include <KConfigWatcher>
  • CMake: find_package(KF6 REQUIRED COMPONENTS Config)
    target_link_libraries(mytarget PRIVATE KF6::ConfigCore)
  • Inherits: QObject

List of all members, including inherited members

Public Types

Public Functions

Signals

Static Public Members

Detailed Description

The configChanged(const KConfigGroup &group, const QByteArrayList &names) signal is emitted whenever another client has updated this config file with the KConfigBase::Notify flag.

KConfigWatcher::Ptr watcher = KConfigWatcher::create(config);
QObject::connect(watcher.data(), &KConfigWatcher::configChanged, [=](){
    qInfo() << "Some config changed!";
});
// ...
generalGroup.writeEntry("SomeKey", "SomeValue", KConfigBase::Notify);
generalGroup.config()->reparseConfiguration();

See also KSharedConfig::Ptr, KConfigBase::WriteConfigFlags, KConfigSkeletonItem::setWriteFlags(), KConfigGroup

Member Type Documentation

KConfigWatcher::Ptr

Member Function Documentation

KSharedConfig::Ptr KConfigWatcher::config() const

Returns the config being watched.

[signal] void KConfigWatcher::configChanged(const KConfigGroup &group, const QByteArrayList &names)

Emitted when a config group has changed, passing the list of names that have changed within that group.

The config will be reloaded before this signal is emitted.

[static] KConfigWatcher::Ptr KConfigWatcher::create(const KSharedConfig::Ptr &config)

Instantiate a ConfigWatcher for a given config

Note: Any additional config sources should be set before this point.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.