Back to Blog home

Bind Aid

Published on Monday March 10, 2008 by Kent Hansen in Labs Bindings Generator Qt Script | Comments

Announcing a new project on Trolltech Labs: Qt Script Generator. It's a tool that generates Qt bindings for Qt Script. Finally your scripts can go "new QPoint()" without you having to manually bind the world first! You not only get the Qt API, but also the possibility to "subclass" in script code, e.g.:

var w = new QWidget();
w.keyPressEvent = function(e) { print(e.key()); }
w.paintEvent = function(e) { ... }

To use the bindings in your own app, you just compile the bindings plugins, put them in your library path and then go like this:

QScriptEngine eng;
eng.importExtension("qt.core");
eng.importExtension("qt.gui");
// also available: qt.sql, qt.xml, qt.svg, qt.network, qt.opengl

Have a look at the examples to get an idea of what you can do. More examples to come.

The generator itself is essentially the Qt Jambi generator with a Qt Script backend. (Great job, Jambi guys!)

Although this project is still very young, we're interested in hearing about any issues (functionality / performance / whatever) you have with the bindings. Have fun!

Subscribe to Our Blog

Stay up to date with the latest marketing, sales and service tips and news.