| 1 | /* |
| 2 | SPDX-FileCopyrightText: 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org> |
| 3 | SPDX-FileCopyrightText: 2002-2003 Daniel Molkentin <molkentin@kde.org> |
| 4 | SPDX-FileCopyrightText: 2006 Matthias Kretz <kretz@kde.org> |
| 5 | SPDX-FileCopyrightText: 2021 Alexander Lohnau <alexander.lohnau@gmx.de> |
| 6 | |
| 7 | SPDX-License-Identifier: LGPL-2.0-only |
| 8 | */ |
| 9 | |
| 10 | #ifndef KCMODULELOADER_H |
| 11 | #define KCMODULELOADER_H |
| 12 | |
| 13 | #include <KPluginMetaData> |
| 14 | #include <kcmodule.h> |
| 15 | |
| 16 | #include <memory> |
| 17 | |
| 18 | class QWidget; |
| 19 | class QQmlEngine; |
| 20 | |
| 21 | /*! |
| 22 | * \namespace KCModuleLoader |
| 23 | * \inmodule KCMUtils |
| 24 | * \brief Loads a KCModule. |
| 25 | * |
| 26 | * In case the provided metadata points to a KQuickConfigModule, it is wrapped in a KCModule. |
| 27 | */ |
| 28 | namespace KCModuleLoader |
| 29 | { |
| 30 | /*! |
| 31 | * Loads a KCModule. If loading fails a KCM which displays an error message is returned. |
| 32 | * |
| 33 | * \a metaData KPluginMetaData for loading the plugin |
| 34 | * |
| 35 | * \a engine QQmlEngine that will be used for KQuickConfigModule classes. |
| 36 | * If none is set, a internal engine will be created and reused for further modules. |
| 37 | * In case your app already has an engine, you should pass it in explicitly |
| 38 | * |
| 39 | * Returns a pointer to the loaded KCModule |
| 40 | */ |
| 41 | KCMUTILS_EXPORT KCModule * |
| 42 | loadModule(const KPluginMetaData &metaData, QWidget *parent = nullptr, const QVariantList &args = {}, const std::shared_ptr<QQmlEngine> &engine = {}); |
| 43 | } |
| 44 | |
| 45 | #endif // KCMODULELOADER_H |
| 46 | |