Commit 498bcac7 authored by Volker Krause's avatar Volker Krause
Browse files

Work around qmlplugindump choking on gadget singletons

That in itself isn't that unusual, but here it happens so early that
ecm_find_qmlmodule() breaks, affecting builds of applications depending
on this.
parent d1c3aac0
Pipeline #57523 passed with stage
in 25 seconds
......@@ -9,6 +9,7 @@
#include <KOpeningHours/IntervalModel>
#include <KOpeningHours/OpeningHours>
#include <QCoreApplication>
#include <QQmlContext>
#include <QQmlEngine>
#include <QQmlExtensionPlugin>
......@@ -47,9 +48,12 @@ void KOpeningHoursQmlPlugin::registerTypes(const char*)
qmlRegisterType<KOpeningHours::IntervalModel>("org.kde.kopeninghours", 1, 0, "IntervalModel");
qmlRegisterSingletonType("org.kde.kopeninghours", 1, 0, "OpeningHoursParser", [](QQmlEngine*, QJSEngine *engine) -> QJSValue {
return engine->toScriptValue(KOpeningHours::OpeningHoursFactory());
});
// HACK qmlplugindump chokes on gadget singletons, to the point of breaking ecm_find_qmlmodule()
if (QCoreApplication::applicationName() != QLatin1String("qmlplugindump")) {
qmlRegisterSingletonType("org.kde.kopeninghours", 1, 0, "OpeningHoursParser", [](QQmlEngine*, QJSEngine *engine) -> QJSValue {
return engine->toScriptValue(KOpeningHours::OpeningHoursFactory());
});
}
}
#include "kopeninghoursqmlplugin.moc"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment