File indexing completed on 2024-11-24 04:50:40
0001 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu> 0002 // SPDX-License-Identifier: LGPL-2.0-or-later 0003 0004 #include "componentsplugin.h" 0005 0006 #include "helper.h" 0007 #include <KAboutData> 0008 #include <QAction> 0009 #include <QQmlEngine> 0010 #include <QtQml> 0011 0012 void ComponentsPlugin::registerTypes(const char *uri) 0013 { 0014 Q_ASSERT(uri == QByteArray("org.kde.merkuro.components")); 0015 qmlRegisterModule(uri, 1, 0); 0016 qmlRegisterSingletonType<Helper>(uri, 1, 0, "Helper", [](QQmlEngine *engine, QJSEngine *scriptEngine) { 0017 Q_UNUSED(engine) 0018 Q_UNUSED(scriptEngine) 0019 return new Helper; 0020 }); 0021 0022 qmlRegisterSingletonType("org.kde.merkuro.components", 1, 0, "About", [](QQmlEngine *engine, QJSEngine *) -> QJSValue { 0023 return engine->toScriptValue(KAboutData::applicationData()); 0024 }); 0025 0026 qRegisterMetaType<QAction *>(); 0027 } 0028 0029 #include "moc_componentsplugin.cpp"