PDA

View Full Version : Evaluation of one QtScript from within another



pancake
2nd February 2010, 11:35
Can I 'evaluate' one QtScript .js file from within another?

The only way I have found is to write a native C++ function that reads a file and returns a string, export this function to QtScript, then "eval" the string within the QtScript. Just wanted to check I wasn't missing some obvious 'dofile' method in QtScript.

This is for an application that makes heavy use of QtScript, allowing (technical!) users to develop complex scripted environments involving multiple files and functions.

Thanks

pancake
8th July 2010, 12:44
Answering my own question a few months later, there is an example of how to do this in the QScriptContext Class Reference - just a case of knowing where to look.