Kirigami-addons

componentsplugin.cpp
1// SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
2// SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
3// SPDX-License-Identifier: LGPL-2.0-or-later
4
5#include <QQmlExtensionPlugin>
6#include <QQmlEngine>
7#include "nameutils.h"
8#include "messagedialoghelper.h"
9
10class ComponentsPlugin : public QQmlExtensionPlugin
11{
13 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
14
15public:
16 ComponentsPlugin() = default;
17 ~ComponentsPlugin() = default;
18 void initializeEngine(QQmlEngine *engine, const char *uri) override;
19 void registerTypes(const char *uri) override;
20};
21
22void ComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
23{
24 Q_UNUSED(engine)
25 Q_UNUSED(uri)
26}
27
28void ComponentsPlugin::registerTypes(const char *uri)
29{
30 qmlRegisterModule(uri, 1, 0);
31 qmlRegisterSingletonType<NameUtils>(uri, 1, 0, "NameUtils", [](QQmlEngine*, QJSEngine*) -> QObject* {
32 return new NameUtils;
33 });
34
35 qmlRegisterSingletonType<MessageDialogHelper>(uri, 1, 0, "MessageDialogHelper", [](QQmlEngine*, QJSEngine*) -> QObject* {
36 return new MessageDialogHelper;
37 });
38}
39
40#include "componentsplugin.moc"
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 3 2024 11:46:57 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.