QtScript
Sebastian Sauer
mail at dipe.org
Fri Feb 9 16:28:52 GMT 2007
Sebastian Sauer wrote:
> Simon Hausmann wrote:
[...]
to provide another idea;
cause Kross as well as QtScript are using the Qt meta system, it could also be
an idea to let Kate Scripts (using QtScript) control Kross and offer that way
support to other scripting backends.
Propably just write a decorator/adaptor/whatever like;
class KrossAdaptor : public QObject {
Q_OBJECT
public slot:
QObject* action(const QString& name) {
return Kross::Manager::self().action(name);
}
[...]
}
and publish those adaptor to your Kate QtScript's which are able to do then
something like;
// take the adaptor and create a Kross::Action instance.
var kross = KrossAdaptor;
var pyaction = kross.action("mypyscript");
// we like to execute some python code
pyaction.setInterpreter("python");
// define here e.g. a py-file...
pyaction.setFile("/home/bla/myscript.py");
// ... or the code.
pyaction.setCode("print \"hello world.\"");
// execute it.
pyaction.trigger();
You are then able to also connect() signals/slots, trade QObject's and such
stuff around.
--
Sebastian Sauer aka dipesh[sebsauer]
http://www.dipe.org/public_key.asc
Fingerprint: 8F1E 219B 16E6 4EC7 29CC F408 E193 65E2 9134 2221
Coder in http://www.koffice.org && http://www.kmldonkey.org
More information about the kde-core-devel
mailing list