Script parser[solved]
-
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? -
Use eval() function.
-
It is js function, you can read more about it "here":http://www.w3schools.com/jsref/jsref_eval.asp
-
You are welcome, please add [solved] to your post title