PDA

View Full Version : I need to evaluate a piece of JavaScript... (solved)



Alec
7th February 2010, 19:31
Hello,

I have a piece of Javascript code that I would like to evaluate from inside my Qt program.

I want to pass a QString into a the Javascript function and then get the result stored in a different QString.

I know there's an evaluateJavaScript function in QWebFrame, but using that doesn't seem right since I would need to pass in the whole script as the argument, concatenated with the call to the function I want to evaluate and the input which needs to be properly escaped (quotation marks, newlines, etc.)

Is there a better way to do that?

Thanks!

Alec
7th February 2010, 21:10
I found a solution with QtScript here:

http://doc.trolltech.com/4.6/qscriptvalue.html#call

Sorry for the noise!