2018-02-26 07:15:25 +01:00
|
|
|
/*
|
2020-02-25 07:26:04 +01:00
|
|
|
SPDX-FileCopyrightText: %{CURRENT_YEAR} %{AUTHOR} <%{EMAIL}>
|
|
|
|
SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
*/
|
2018-02-26 07:15:25 +01:00
|
|
|
|
|
|
|
#include "%{APPNAMELC}plugin.h"
|
|
|
|
|
|
|
|
// KF
|
|
|
|
#include <KLocalizedString>
|
|
|
|
// Qt
|
|
|
|
#include <QJSEngine>
|
|
|
|
#include <QQmlEngine>
|
|
|
|
#include <QQmlContext>
|
|
|
|
|
|
|
|
static QJSValue singletonTypeExampleProvider(QQmlEngine* engine, QJSEngine* scriptEngine)
|
|
|
|
{
|
|
|
|
Q_UNUSED(engine)
|
|
|
|
|
|
|
|
QJSValue helloWorld = scriptEngine->newObject();
|
|
|
|
helloWorld.setProperty("text", i18n("Hello world!"));
|
|
|
|
return helloWorld;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void %{APPNAME}Plugin::registerTypes(const char* uri)
|
|
|
|
{
|
|
|
|
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.%{APPNAMELC}"));
|
|
|
|
|
|
|
|
qmlRegisterSingletonType(uri, 1, 0, "HelloWorld", singletonTypeExampleProvider);
|
|
|
|
}
|