PDA

View Full Version : Basic QtScript question



jimboqt
23rd September 2008, 14:09
I've read through the QtScript docs, and as I understand it, to enable QObject derived objects to be available in scripts, I have to do something like this: -


QScriptEngine engine;
QObject *someObject = new MyObject;
QScriptValue objectValue = engine.newQObject(someObject);
engine.globalObject().setProperty("myObject", objectValue);


That's fine, and makes sense. However, I want the scripts to be able to use Qt's built-in objects, such as QDialog and other UI widgets, QFile, QDir, and many more. Is this only possible by manually setting each object as in the above code? Or did I miss something in the documentation...?

Thanks