[Kde-bindings] include in QScript via Kross
Richard Dale
richard.dale at telefonica.net
Mon Mar 8 12:33:10 UTC 2010
On Monday 08 March 2010 11:57:14 am Andreas Marschke wrote:
> Hi!
>
> Some days ago sebsauer did me a favor and added an include function to
> QScript in Kross which enables users to open up additional functionality
> in Krosses QScript. The problem now is when I run something like
> include("svg");
> or
> include("qtscript_svg");
> I get :
> Error: Unable to import qtscript_svg: no such extension.
>
> I've checked if the svg plugin is in the QT_PLUGIN/scripts/ directory and
> yes it is. Was it just a typo from me or did I do something substentially
> wrong when trying to include these plugins?
How have you defined your plugin class? In the JSmoke bindings the qt svg
module is defined like this:
class jsmoke_qtsvg_ScriptPlugin : public QScriptExtensionPlugin
{
public:
QStringList keys() const;
void initialize(const QString &key, QScriptEngine *engine);
};
QStringList jsmoke_qtsvg_ScriptPlugin::keys() const
{
QStringList list;
list << QLatin1String("jsmoke");
list << QLatin1String("jsmoke.qtsvg");
return list;
}
void jsmoke_qtsvg_ScriptPlugin::initialize(const QString &key, QScriptEngine
*engine)
{
if (key == QLatin1String("jsmoke")) {
} else if (key == QLatin1String("jsmoke.qtsvg")) {
QScriptValue extensionObject = engine->globalObject();
qtscript_initialize_jsmoke_qtsvg_bindings(extensionObject);
} else {
Q_ASSERT_X(false, "jsmoke_qtsvg::initialize", qPrintable(key));
}
}
Q_EXPORT_STATIC_PLUGIN(jsmoke_qtsvg_ScriptPlugin)
Q_EXPORT_PLUGIN2(jsmoke_qtsvg, jsmoke_qtsvg_ScriptPlugin)
Then I can import using the name "jsmoke.qtsvg" in javascript programs.
-- Richard
More information about the Kde-bindings
mailing list