KCModuleData Class

A base class that offers information about a KCModule state. More...

Header: #include <KCModuleData>
CMake: find_package(KF6 REQUIRED COMPONENTS KCMUtils)
target_link_libraries(mytarget PRIVATE KCMUtilsCore)
Inherits: QObject

Public Functions

KCModuleData(QObject *parent = nullptr)
(since 6.18) QAction *auxiliaryAction() const
virtual bool isDefaults() const
virtual bool matchesQuery(const QString &query) const
virtual void revertToDefaults()

Signals

(since 6.18) void auxiliaryActionChanged(QAction *action)
void loaded()
(since 6.18) void relevantChanged(bool relevant)

Protected Functions

void setAuxiliaryAction(QAction *action)
void setRelevant(bool relevant)

Protected Slots

void autoRegisterSkeletons()
void registerSkeleton(KCoreConfigSkeleton *skeleton)

Detailed Description

Member Function Documentation

[explicit] KCModuleData::KCModuleData(QObject *parent = nullptr)

[protected slot] void KCModuleData::autoRegisterSkeletons()

Automatically register child skeletons.

Call it in your subclass constructor after skeleton creation

[since 6.18] QAction *KCModuleData::auxiliaryAction() const

An auxiliary action associated with this KCM.

This function was introduced in 6.18.

See also setAuxiliaryAction().

[signal, since 6.18] void KCModuleData::auxiliaryActionChanged(QAction *action)

Emitted when the auxiliary action changes.

Note: The QAction can change its state (e.g. being enabled) without the action object itself being replaced.

This function was introduced in 6.18.

[virtual] bool KCModuleData::isDefaults() const

Checks if the configuration is identical to the default one.

Returns true if the module configuration is in the default state, false otherwise.

[signal] void KCModuleData::loaded()

Emitted when KCModuleData is loaded.

[virtual] bool KCModuleData::matchesQuery(const QString &query) const

Returns whether this module matches a given query.

The query is not expected to be a regex pattern but a full text search.

[protected slot] void KCModuleData::registerSkeleton(KCoreConfigSkeleton *skeleton)

Allow to manually register a skeleton class.

Used by a derived class when automatic discovery is not possible.

[signal, since 6.18] void KCModuleData::relevantChanged(bool relevant)

Emitted when the relevancy of this KCM changes.

For example, after (un)plugging a relevant device.

This function was introduced in 6.18.

[virtual] void KCModuleData::revertToDefaults()

Reverts the module to default values and saves them.

[protected] void KCModuleData::setAuxiliaryAction(QAction *action)

Sets an auxiliary action for this KCM.

This can be displayed alongside this KCM in a list of settings and provide quick access to a feature in the KCM without opening it.

For example, a "Pair new device" action or, in case of a checkable action, a Switch to turn on/off a certain feature or device.

See also auxiliaryAction().

[protected] void KCModuleData::setRelevant(bool relevant)

Sets whether this KCM is relevant in the current environment.

This can hide the KCM in a list of settings when it is currently not relevant.

For example to show touchscreen settings only when a touchscreen is present. Default is true.