Kirigami2

platformpluginfactory.h
1/*
2 * SPDX-FileCopyrightText: 2017 by Marco Martin <mart@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef KIRIGAMI_PLATFORMPLUGINFACTORY_H
8#define KIRIGAMI_PLATFORMPLUGINFACTORY_H
9
10#include <QObject>
11
12#include "kirigamiplatform_export.h"
13
14class QQmlEngine;
15
16namespace Kirigami
17{
18namespace Platform
19{
20class PlatformTheme;
21class Units;
22
23/**
24 * @class PlatformPluginFactory platformpluginfactory.h <Kirigami/PlatformPluginFactory>
25 *
26 * This class is reimpleented by plugins to provide different implementations
27 * of PlatformTheme
28 */
29class KIRIGAMIPLATFORM_EXPORT PlatformPluginFactory : public QObject
30{
31 Q_OBJECT
32
33public:
34 explicit PlatformPluginFactory(QObject *parent = nullptr);
35 ~PlatformPluginFactory() override;
36
37 /**
38 * Creates an instance of PlatformTheme which can come out from
39 * an implementation provided by a plugin
40 *
41 * If this returns nullptr the PlatformTheme will use a fallback
42 * implementation that loads a theme definition from a QML file.
43 *
44 * @param parent the parent object of the created PlatformTheme
45 */
47
48 /**
49 * Creates an instance of Units which can come from an implementation
50 * provided by a plugin
51 * @param parent the parent of the units object
52 */
53 virtual Units *createUnits(QObject *parent) = 0;
54
55 /**
56 * finds the plugin providing units and platformtheme for the current style
57 * The plugin pointer is cached, so only the first call is a potentially heavy operation
58 * @param pluginName The name we want to search for, if empty the name of
59 * the current QtQuickControls style will be searched
60 * @return pointer to the PlatformPluginFactory of the current style
61 */
62 static PlatformPluginFactory *findPlugin(const QString &pluginName = {});
63};
64
65}
66}
67
68QT_BEGIN_NAMESPACE
69#define PlatformPluginFactory_iid "org.kde.kirigami.PlatformPluginFactory"
70Q_DECLARE_INTERFACE(Kirigami::Platform::PlatformPluginFactory, PlatformPluginFactory_iid)
71QT_END_NAMESPACE
72
73#endif // PLATFORMPLUGINFACTORY_H
This class is reimpleented by plugins to provide different implementations of PlatformTheme.
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.
This class is the base for color management in Kirigami, different platforms can reimplement this cla...
A set of values to define semantically sizes and durations.
Definition units.h:80
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:46 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.