Is it possible to use javascript functions in my Qt desktop project?
If yes, can you show some example like how can I define function?
I always find QML examples on the net but my project is a desktop project.
Is it possible to use javascript functions in my Qt desktop project?
If yes, can you show some example like how can I define function?
I always find QML examples on the net but my project is a desktop project.
Last edited by sipahi; 31st January 2013 at 10:22.
Yes.
If yes, can you show some example like how can I define function?Qt Code:
QScriptEngine engine; //... QScriptValue fun = engine.evaluate("(function() { return 7; })"); // ... int retVal = 0; if(fun.isFunction()) { retVal = fun.call().toInt32(); }To copy to clipboard, switch view to plain text mode
thank you for your answer @wysota.
Qt Documentation has a couple of examples around the topic of using QtScript
http://qt-project.org/doc/qt-4.8/examples-script.html
Cheers,
_
sipahi (31st January 2013)
Bookmarks