Script parser[solved]
-
wrote on 8 Aug 2011, 08:55 last edited by
Hellow, i need to create script math parser, for example i have this string: 1+2+3, and i want to find answer with scripts, how can i do it?
I try:
@ QScriptEngine scriptEngine;
QScriptValue scriptLineEdit = scriptEngine.newQObject(lineEdit);
scriptEngine.globalObject().setProperty("lineEdit", scriptLineEdit);
scriptEngine.evaluate("var answer = lineEdit.txt;" //<---
"lineEdit.text = answer;");@
How can I make so that the line was interpreted as a command, not a string? -
wrote on 8 Aug 2011, 08:58 last edited by
Use eval() function.
-
wrote on 8 Aug 2011, 09:09 last edited by
Could you tell me more about this function, as assistant about i found nothing it
-
wrote on 8 Aug 2011, 09:10 last edited by
It is js function, you can read more about it "here":http://www.w3schools.com/jsref/jsref_eval.asp
-
wrote on 8 Aug 2011, 09:30 last edited by
It is work, thank you for your help!
-
wrote on 8 Aug 2011, 09:52 last edited by
You are welcome, please add [solved] to your post title
6/6