Who knows the value of global variables in the qt qtscript script to access the global variable to change the global variable value; [closed]
- by dawntrees
Who knows the value of global variables in the qt qtscript script to access the global variable to change the global variable value;
forexample
int gVar=0;
int main(int argc, char *argv[])
{
QScriptEngine engine;
QScriptValue varValue = m_engine-newVariant(gVar);
engine.globalObject().setProperty("gVar", varValue);
QScriptValue result = m_engine->evaluate("gVar=100;");
qDebug()<<"gVar================"<<gVar;
return 0;
}
Why gVar = 0 and not equal to 100; how can we make gVar equal to 100(gVar=100)
Who can help group I appreciate it, thanks!