[Qt-interest] Regarding scripting and QT
Bastian Bense
bastibense at gmail.com
Wed Aug 25 21:04:44 CEST 2010
Hi,
basically making applications scriptable is very common. There are a number of languages (one of my favourites being Lua for being so small and embeddable).
If you are new to this but are familiar with Qt, you should start with QtScript. The general workflow is as follows:
- Create a QObject based class that has "public slots" (those will be available to the scripting environment)
- For more functionality also let your class inherit from QScriptable (this gives you access to the engine, method context, etc).
- Create a new QScriptEngine and use use newQObject() to register your class instance with the script engine, then use myEngine.globalObject().setProperty("myObj", myObjInstance) to make the object available as global variable
- Execute the script code using evaluate()
You'll get a feeling for the whole process rather quick.
Also check the examples and the very good documentation that comes with Qt.
Hope that helps. :)
Basti
Am 25.08.2010 um 19:34 schrieb Patric:
> can someone please give me a simple description of the scripting idea
> and it's connection with QT ? This is the first time I hear something
> about "making C++ app scriptable". It seems there is not much general
> information on the net regarding this topic.
More information about the Qt-interest-old
mailing list