Kirigami2

kirigamipluginfactory.h
1 /*
2  * SPDX-FileCopyrightText: 2017 by Marco Martin <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 
7 #ifndef KIRIGAMIPLUGINFACTORY_H
8 #define KIRIGAMIPLUGINFACTORY_H
9 
10 #include "platformtheme.h"
11 #include <QObject>
12 
13 #ifndef KIRIGAMI_BUILD_TYPE_STATIC
14 #include "kirigami2_export.h"
15 #endif
16 
17 class QQmlEngine;
18 
19 namespace Kirigami {
20 class Units;
21 
22 /**
23  * @class KirigamiPluginFactory kirigamipluginfactory.h <Kirigami/KirigamiPluginFactory>
24  *
25  * This class is reimpleented by plugins to provide different implementations
26  * of PlatformTheme
27  */
28 #ifdef KIRIGAMI_BUILD_TYPE_STATIC
29 class KirigamiPluginFactory : public QObject
30 #else
31 class KIRIGAMI2_EXPORT KirigamiPluginFactory : public QObject
32 #endif
33 {
34  Q_OBJECT
35 
36 public:
37  explicit KirigamiPluginFactory(QObject *parent = nullptr);
38  ~KirigamiPluginFactory() override;
39 
40  /**
41  * Creates an instance of PlatformTheme which can come out from
42  * an implementation provided by a plugin
43  *
44  * If this returns nullptr the PlatformTheme will use a fallback
45  * implementation that loads a theme definition from a QML file.
46  *
47  * @param parent the parent object of the created PlatformTheme
48  */
50 
51  /**
52  * finds the plugin providing units and platformtheme for the current style
53  * The plugin pointer is cached, so only the first call is a potentially heavy operation
54  * @return pointer to the KirigamiPluginFactory of the current style
55  */
57 };
58 
59 // TODO KF6 unify KirigamiPluginFactory and KirigamiPluginFactoryV2 again
60 /**
61  * This class provides an extended version of KirigamiPluginFactory.
62  * Plugins that support Units need to implement it instead of KirigamiPluginFactory.
63  */
64 #ifdef KIRIGAMI_BUILD_TYPE_STATIC
66 #else
67 class KIRIGAMI2_EXPORT KirigamiPluginFactoryV2 : public KirigamiPluginFactory
68 #endif
69 {
70  Q_OBJECT
71 
72 public:
73  explicit KirigamiPluginFactoryV2(QObject *parent = nullptr);
74  ~KirigamiPluginFactoryV2() override;
75 
76  /**
77  * Creates an instance of Units which can come from an implementation
78  * provided by a plugin
79  * @param parent the parent of the units object
80  */
81  virtual Units *createUnits(QObject *parent) = 0;
82 };
83 }
84 
85 QT_BEGIN_NAMESPACE
86 #define KirigamiPluginFactory_iid "org.kde.kirigami.KirigamiPluginFactory"
87 Q_DECLARE_INTERFACE(Kirigami::KirigamiPluginFactory, KirigamiPluginFactory_iid)
88 QT_END_NAMESPACE
89 
90 #endif // KIRIGAMIPLUGINFACTORY_H
Q_OBJECTQ_OBJECT
This class provides an extended version of KirigamiPluginFactory.
virtual Units * createUnits(QObject *parent)=0
Creates an instance of Units which can come from an implementation provided by a plugin.
virtual PlatformTheme * createPlatformTheme(QObject *parent)=0
Creates an instance of PlatformTheme which can come out from an implementation provided by a plugin.
static KirigamiPluginFactory * findPlugin()
finds the plugin providing units and platformtheme for the current style The plugin pointer is cached...
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:14:23 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.