[Kde-bindings] include in QScript via Kross

Richard Dale richard.dale at telefonica.net
Mon Mar 8 15:14:10 UTC 2010


On Monday 08 March 2010 02:19:05 pm Andreas Marschke wrote:
> Am Montag 08 März 2010 13:33:10 schrieb Richard Dale:
> > 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
> 
> I didnt write them myself actually they  are provided by my distro(Debian).
> See the source package for qtscriptgenerator as a source of what they did.
> afais its prewritten code from a *.pri file they just run qmake and
> compile.
> 
> The file is actually libqtscript_network.so and strings told me the handy :
> qt.network for this but this didnt work in this case for some reason.
A key string of "qt.network" should be ok - perhaps the plugin isn't being 
found. You could try setting QT_DEBUG_PLUGINS to get some diagnostics about 
which directories are being searched.

-- Richard



More information about the Kde-bindings mailing list