KCModule

Search for usage in LXR

#include <KCModule>

Inheritance diagram for KCModule:

Public Member Functions

 KCModule (QWidget *parent, const KPluginMetaData &data)
 
 ~KCModule () override
 
QList< KConfigDialogManager * > configs () const
 
void defaults () override
 
void load () override
 
void markAsChanged ()
 
void save () override
 
virtual QWidgetwidget ()
 
- Public Member Functions inherited from KAbstractConfigModule
 KAbstractConfigModule (QObject *parent, const KPluginMetaData &metaData)
 
Q_SIGNAL void activationRequested (const QVariantList &args)
 
QString authActionName () const
 
Q_SIGNAL void authActionNameChanged ()
 
Buttons buttons () const
 
Q_SIGNAL void buttonsChanged ()
 
bool defaultsIndicatorsVisible () const
 
Q_SIGNAL void defaultsIndicatorsVisibleChanged ()
 
QString description () const
 
KPluginMetaData metaData () const
 
QString name () const
 
bool needsAuthorization () const
 
bool needsSave () const
 
Q_SIGNAL void needsSaveChanged ()
 
bool representsDefaults () const
 
Q_SIGNAL void representsDefaultsChanged ()
 
void setAuthActionName (const QString &action)
 
void setButtons (const Buttons btn)
 
void setDefaultsIndicatorsVisible (bool visible)
 
void setNeedsSave (bool needs)
 
void setRepresentsDefaults (bool defaults)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo () const const
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Slots

void widgetChanged ()
 

Protected Member Functions

 KCModule (QObject *parent)
 
 KCModule (QObject *parent, const KPluginMetaData &data)
 
KConfigDialogManageraddConfig (KCoreConfigSkeleton *config, QWidget *widget)
 
bool managedWidgetChangeState () const
 
bool managedWidgetDefaultState () const
 
void unmanagedWidgetChangeState (bool)
 
void unmanagedWidgetDefaultState (bool)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Public Types inherited from KAbstractConfigModule
enum  Button {
  NoAdditionalButton = 0 , Help = 1 , Default = 2 , Apply = 4 ,
  Export = 8
}
 
typedef QFlags< ButtonButtons
 
- Public Types inherited from QObject
typedef  QObjectList
 
- Properties inherited from KAbstractConfigModule
KAbstractConfigModule::Buttons buttons
 
bool defaultsIndicatorsVisible
 
QString description
 
QString name
 
bool needsAuthorization
 
bool needsSave
 
bool representsDefaults
 
- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 

Detailed Description

The base class for QWidgets configuration modules.

Configuration modules are loaded as plugins.

The module in principle is a simple widget displaying the item to be changed. The module has a very small interface.

To write a config module, you have to create a library that contains a factory class like the following:

#include <KPluginFactory>
K_PLUGIN_CLASS_WITH_JSON(MyKCModule, "mykcmodule.json")
#define K_PLUGIN_CLASS_WITH_JSON(classname, jsonFile)

The constructor of the KCModule then looks like this:

YourKCModule::YourKCModule(QWidget *parent, const KPluginMetaData &data)
: KCModule(parent, data)
{
// KCModule does not directly extend QWidget due to ambiguity with KAbstractConfigModule
// Because of this, you need to call widget() to get the parent widget
auto label = new QLabel(widget());
label->setText(QStringLiteral("Demo Text"));
}
The base class for QWidgets configuration modules.
Definition kcmodule.h:59
QObject * parent() const const

This KCM can be loaded in a KCMultiDialog of kcmshell6

Since
6.0

Definition at line 58 of file kcmodule.h.

Constructor & Destructor Documentation

◆ KCModule() [1/3]

KCModule::KCModule ( QWidget * parent,
const KPluginMetaData & data )
explicit

Base class for all QWidgets configuration modules.

Note
do not emit changed signals here, since they are not yet connected to any slot.

Definition at line 60 of file kcmodule.cpp.

◆ ~KCModule()

KCModule::~KCModule ( )
override

Destroys the module.

Definition at line 78 of file kcmodule.cpp.

◆ KCModule() [2/3]

KCModule::KCModule ( QObject * parent,
const KPluginMetaData & data )
inlineexplicitprotected

Utility overload to avoid having to take both parent and parentWidget KCModuleLoader::loadModule enforces the parent to be a QWidget anyway.

Definition at line 147 of file kcmodule.h.

◆ KCModule() [3/3]

KCModule::KCModule ( QObject * parent)
inlineexplicitprotected

Utility constructor for creating a KCModule that is embedded, for example in a KPluginWidget This constructor should not be used for KCMs that are part launched in systemsettings!

Note
do not emit changed signals here, since they are not yet connected to any slot.

Definition at line 159 of file kcmodule.h.

Member Function Documentation

◆ addConfig()

KConfigDialogManager * KCModule::addConfig ( KCoreConfigSkeleton * config,
QWidget * widget )
protected

Adds a KCoreConfigskeleton config to watch the widget widget.

This function is useful if you need to handle multiple configuration files.

Returns
a pointer to the KCoreConfigDialogManager in use
Parameters
configthe KCoreConfigSkeleton to use
widgetthe widget to watch

Definition at line 66 of file kcmodule.cpp.

◆ configs()

QList< KConfigDialogManager * > KCModule::configs ( ) const
Returns
a list of KConfigDialogManager's in use, if any.

Definition at line 164 of file kcmodule.cpp.

◆ defaults()

void KCModule::defaults ( )
overridevirtual

Sets the configuration to default values.

This method is called when the user clicks the "Default" button.

Reimplemented from KAbstractConfigModule.

Definition at line 101 of file kcmodule.cpp.

◆ load()

void KCModule::load ( )
overridevirtual

Load the configuration data into the module.

The load method sets the user interface elements of the module to reflect the current settings stored in the configuration files.

This method is invoked whenever the module should read its configuration (most of the times from a config file) and update the user interface. This happens when the user clicks the "Reset" button in the control center, to undo all of his changes and restore the currently valid settings. It is also called right after construction.

Reimplemented from KAbstractConfigModule.

Definition at line 84 of file kcmodule.cpp.

◆ managedWidgetChangeState()

bool KCModule::managedWidgetChangeState ( ) const
protected

Returns the changed state of automatically managed widgets in this dialog.

Definition at line 129 of file kcmodule.cpp.

◆ managedWidgetDefaultState()

bool KCModule::managedWidgetDefaultState ( ) const
protected

Returns the defaulted state of automatically managed widgets in this dialog.

Definition at line 140 of file kcmodule.cpp.

◆ markAsChanged()

void KCModule::markAsChanged ( )
inline

Utility function that marks the KCM as changed.

Definition at line 88 of file kcmodule.h.

◆ save()

void KCModule::save ( )
overridevirtual

The save method stores the config information as shown in the user interface in the config files.

This method is called when the user clicks "Apply" or "Ok".

Reimplemented from KAbstractConfigModule.

Definition at line 93 of file kcmodule.cpp.

◆ unmanagedWidgetChangeState()

void KCModule::unmanagedWidgetChangeState ( bool changed)
protected

Call this method when your manually managed widgets change state between changed and not changed.

Definition at line 151 of file kcmodule.cpp.

◆ unmanagedWidgetDefaultState()

void KCModule::unmanagedWidgetDefaultState ( bool defaulted)
protected

Call this method when your manually managed widgets change state between defaulted and not defaulted.

Definition at line 157 of file kcmodule.cpp.

◆ widget()

QWidget * KCModule::widget ( )
virtual

Get the associated widget that can be embedded The returned widget should be used as a parent for widgets you create.

Note
Overwriting this function should not be necessary for consumers!

Definition at line 109 of file kcmodule.cpp.

◆ widgetChanged

void KCModule::widgetChanged ( )
protectedslot

A managed widget was changed, the widget settings and the current settings are compared and a corresponding needsSaveChanged() signal is emitted.

Definition at line 119 of file kcmodule.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:51:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.