KConfigWatcher Class
Watches for configuration changes. More...
| Header: | #include <KConfigWatcher> |
| CMake: | find_package(KF6 REQUIRED COMPONENTS Config)target_link_libraries(mytarget PRIVATE KF6::ConfigCore) |
Public Types
Public Functions
| KSharedConfig::Ptr | config() const |
Signals
| void | configChanged(const KConfigGroup &group, const QByteArrayList &names) |
Static Public Members
| KConfigWatcher::Ptr | create(const KSharedConfig::Ptr &config) |
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(), and 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.