KQuickConfigModule

Search for usage in LXR

#include <KQuickConfigModule>

Inheritance diagram for KQuickConfigModule:

Properties

int columnWidth
 
int currentIndex
 
int depth
 
QQuickItemmainUi
 
- Properties inherited from KAbstractConfigModule
KAbstractConfigModule::Buttons buttons
 
bool defaultsIndicatorsVisible
 
QString description
 
QString name
 
bool needsAuthorization
 
bool needsSave
 
bool representsDefaults
 
- Properties inherited from QObject
 objectName
 

Signals

void columnWidthChanged (int width)
 
void currentIndexChanged (int index)
 
void depthChanged (int index)
 
void mainUiReady ()
 
void pagePushed (QQuickItem *page)
 
void pageRemoved ()
 

Public Slots

void pop ()
 
void push (const QString &fileName, const QVariantMap &initialProperties=QVariantMap())
 
void push (QQuickItem *item)
 
QQuickItemtakeLast ()
 

Public Member Functions

 ~KQuickConfigModule () override
 
int columnWidth () const
 
int currentIndex () const
 
int depth () const
 
std::shared_ptr< QQmlEngineengine () const
 
QString errorString () const
 
QQuickItemmainUi ()
 
void setColumnWidth (int width)
 
void setCurrentIndex (int index)
 
QQuickItemsubPage (int index) const
 
- 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 ()
 
virtual void defaults ()
 
bool defaultsIndicatorsVisible () const
 
Q_SIGNAL void defaultsIndicatorsVisibleChanged ()
 
QString description () const
 
virtual void load ()
 
KPluginMetaData metaData () const
 
QString name () const
 
bool needsAuthorization () const
 
bool needsSave () const
 
Q_SIGNAL void needsSaveChanged ()
 
bool representsDefaults () const
 
Q_SIGNAL void representsDefaultsChanged ()
 
virtual void save ()
 
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
 

Static Public Member Functions

static KQuickConfigModuleqmlAttachedProperties (QObject *object)
 
- 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)
 

Protected Member Functions

 KQuickConfigModule (QObject *parent, const KPluginMetaData &metaData)
 
- 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 Attributes inherited from QObject
typedef QObjectList
 

Detailed Description

The base class for QtQuick configuration modules.

Configuration modules are realized as plugins that are dynamically loaded.

All the necessary glue logic and the GUI bells and whistles are provided by the control center and must not concern the module author.

To write a config module, you have to create a C++ plugin and an accompaning QML user interface.

To allow KCMUtils to load your ConfigModule subclass, you must create a KPluginFactory implementation.

#include <KPluginFactory>
K_PLUGIN_CLASS_WITH_JSON(MyConfigModule, "yourmetadata.json")
#define K_PLUGIN_CLASS_WITH_JSON(classname, jsonFile)

The constructor of the ConfigModule then looks like this:

YourConfigModule::YourConfigModule(QObject *parent, const KPluginMetaData &metaData)
{
}
KPluginMetaData metaData() const
Returns the metaData that was used when instantiating the plugin.
The base class for QtQuick configuration modules.
QObject * parent() const const

The QML part must be in the KPackage format, installed under share/kpackage/kcms.

See also
KPackage::Package

The package must have the same name as the plugin filename, to be installed by CMake with the command:

kpackage_install_package(packagedir kcm_yourconfigmodule kcms)

The "packagedir" is the subdirectory in the source tree where the package sources are located, and "kcm_yourconfigmodule" is id of the plugin. Finally "kcms" is the literal string "kcms", so that the package is installed as a configuration module (and not some other kind of package).

The QML part can access all the properties of ConfigModule (together with the properties defined in its subclass) by accessing to the global object "kcm", or with the import of "org.kde.kcmutils" the ConfigModule attached property.

import QtQuick
import QtQuick.Controls as QQC2
import org.kde.kcmutils as KCMUtils
import org.kde.kirigami as Kirigami
Item {
// implicit size will be used as initial size when loaded in kcmshell6
implicitWidth: Kirigami.Units.gridUnit * 30
implicitHeight: Kirigami.Units.gridUnit * 30
KCMUtils.ConfigModule.buttons: KCMUtils.ConfigModule.Help | KCMUtils.ConfigModule.Apply
QQC2.Label {
// The following two bindings are equivalent:
text: kcm.needsSave
enabled: KCMUtils.ConfigModule.needsSave
}
}

See https://develop.kde.org/docs/extend/kcm/ for more detailed documentation.

Since
6.0

Definition at line 105 of file kquickconfigmodule.h.

Property Documentation

◆ columnWidth

int KQuickConfigModule::columnWidth
readwrite

Definition at line 110 of file kquickconfigmodule.h.

◆ currentIndex

int KQuickConfigModule::currentIndex
readwrite

Definition at line 112 of file kquickconfigmodule.h.

◆ depth

int KQuickConfigModule::depth
read

Definition at line 111 of file kquickconfigmodule.h.

◆ mainUi

QQuickItem * KQuickConfigModule::mainUi
read

Definition at line 109 of file kquickconfigmodule.h.

Constructor & Destructor Documentation

◆ ~KQuickConfigModule()

KQuickConfigModule::~KQuickConfigModule ( )
override

Destroys the module.

Definition at line 71 of file kquickconfigmodule.cpp.

◆ KQuickConfigModule()

KQuickConfigModule::KQuickConfigModule ( QObject * parent,
const KPluginMetaData & metaData )
explicitprotected

Base class for all QtQuick config modules.

Use KQuickConfigModuleLoader to instantiate this class

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

Definition at line 60 of file kquickconfigmodule.cpp.

Member Function Documentation

◆ columnWidth()

int KQuickConfigModule::columnWidth ( ) const

returns the width the kcm wants in column mode.

If a columnWidth is valid ( > 0 ) and less than the systemsettings' view width, more than one will be visible at once, and the first page will be a sidebar to the last page pushed. As default, this is -1 which will make the shell always show only one page at a time.

Definition at line 200 of file kquickconfigmodule.cpp.

◆ columnWidthChanged

void KQuickConfigModule::columnWidthChanged ( int width)
signal

Emitted when the wanted column width of the kcm changes.

◆ currentIndex()

int KQuickConfigModule::currentIndex ( ) const
Returns
the index of the page this kcm should display

Definition at line 231 of file kquickconfigmodule.cpp.

◆ currentIndexChanged

void KQuickConfigModule::currentIndexChanged ( int index)
signal

Emitted when the current page changed.

◆ depth()

int KQuickConfigModule::depth ( ) const
Returns
how many pages this kcm has. It is guaranteed to be at least 1 (the main ui) plus how many times a new page has been pushed without pop

Definition at line 215 of file kquickconfigmodule.cpp.

◆ depthChanged

void KQuickConfigModule::depthChanged ( int index)
signal

Emitted when the number of pages changed.

◆ engine()

std::shared_ptr< QQmlEngine > KQuickConfigModule::engine ( ) const
Returns
the qml engine that built the main config UI

Definition at line 236 of file kquickconfigmodule.cpp.

◆ errorString()

QString KQuickConfigModule::errorString ( ) const

The error string in case the mainUi failed to load.

Definition at line 241 of file kquickconfigmodule.cpp.

◆ mainUi()

QQuickItem * KQuickConfigModule::mainUi ( )
Returns
The main UI for this configuration module. It's a QQuickItem coming from the QML package named the same as the KAboutData's component name for this config module

◆ mainUiReady

void KQuickConfigModule::mainUiReady ( )
signal

Emitted when the main Ui has loaded successfully and mainUi() is available.

◆ pagePushed

void KQuickConfigModule::pagePushed ( QQuickItem * page)
signal

Emitted when a new sub page is pushed.

◆ pageRemoved

void KQuickConfigModule::pageRemoved ( )
signal

Emitted when a sub page is popped.

◆ pop

void KQuickConfigModule::pop ( )
slot

pop the last page of the KCM hierarchy, the page is destroyed

Definition at line 181 of file kquickconfigmodule.cpp.

◆ push [1/2]

void KQuickConfigModule::push ( const QString & fileName,
const QVariantMap & initialProperties = QVariantMap() )
slot

Push a new sub page in the KCM hierarchy: pages will be seen as a Kirigami PageRow.

Definition at line 141 of file kquickconfigmodule.cpp.

◆ push [2/2]

void KQuickConfigModule::push ( QQuickItem * item)
slot

Definition at line 168 of file kquickconfigmodule.cpp.

◆ qmlAttachedProperties()

KQuickConfigModule * KQuickConfigModule::qmlAttachedProperties ( QObject * object)
static

Definition at line 82 of file kquickconfigmodule.cpp.

◆ setColumnWidth()

void KQuickConfigModule::setColumnWidth ( int width)

Sets the column width we want.

Definition at line 205 of file kquickconfigmodule.cpp.

◆ setCurrentIndex()

void KQuickConfigModule::setCurrentIndex ( int index)

Sets the current page index this kcm should display.

Definition at line 220 of file kquickconfigmodule.cpp.

◆ subPage()

QQuickItem * KQuickConfigModule::subPage ( int index) const

Definition at line 246 of file kquickconfigmodule.cpp.

◆ takeLast

QQuickItem * KQuickConfigModule::takeLast ( )
slot

remove and return the last page of the KCM hierarchy: the popped page won't be deleted, it's the caller's responsibility to manage the lifetime of the returned item

Returns
the last page if any, nullptr otherwise

Definition at line 188 of file kquickconfigmodule.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 Jul 26 2024 11:53:48 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.