diff --git a/src/scripting/genericscriptedconfig.cpp b/src/scripting/genericscriptedconfig.cpp index 0be341631b..9b23154577 100644 --- a/src/scripting/genericscriptedconfig.cpp +++ b/src/scripting/genericscriptedconfig.cpp @@ -30,9 +30,18 @@ QObject *GenericScriptedConfigFactory::create(const char *iface, QWidget *parent Q_UNUSED(iface) Q_UNUSED(parent) Q_UNUSED(keyword) - Q_ASSERT(!args.isEmpty()); - const QString pluginId = args.first().toString(); + // the plugin id is in the args when created by desktop effects kcm or EffectsModel in general + QString pluginId = args.isEmpty() ? QString() : args.first().toString(); + + // If we do not get the id of the effect we want to load from the args, we have to check our metadata. + // This can be the case if the factory gets loaded from a KPluginSelector + // the plugin id is in plugin factory metadata when created by scripts kcm + // (because it uses kpluginselector, which doesn't pass the plugin id as the first arg), + // can be dropped once the scripts kcm is ported to qtquick (because then we could pass the plugin id via the args) + if (pluginId.isEmpty()) { + pluginId = metaData().pluginId(); + } if (pluginId.startsWith(QLatin1String("kwin4_effect_"))) { return new ScriptedEffectConfig(pluginId, parentWidget, args); } else {