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 | * @short Loads a KCModule |
23 | * In case the provided metadata points to a KQuickConfigModule, it is wrapped in a KCModule |
24 | */ |
25 | namespace KCModuleLoader |
26 | { |
27 | /** |
28 | * Loads a @ref KCModule. If loading fails a KCM which displays an error message is returned. |
29 | * |
30 | * @param metaData KPluginMetaData for loading the plugin |
31 | * @param engine QQmlEngine that will be used for KQuickConfigModule classes. |
32 | * If none is set, a internal engine will be created and reused for further modules. |
33 | * In case your app already has an engine, you should pass it in explicitly |
34 | * |
35 | * @return a pointer to the loaded @ref KCModule |
36 | */ |
37 | KCMUTILS_EXPORT KCModule * |
38 | loadModule(const KPluginMetaData &metaData, QWidget *parent = nullptr, const QVariantList &args = {}, const std::shared_ptr<QQmlEngine> &engine = {}); |
39 | } |
40 | |
41 | #endif // KCMODULELOADER_H |
42 | |