this one now works....
//CLASS DECL
//USE THE Q_OBJECT macro
#include "main.moc"
int main(int argc, char **argv)
{
Q_UNUSED(argc)
Q_UNUSED(argv)
MyObject *myObj = new MyObject;
QScriptEngine eng;
eng.globalObject().setProperty("obj", eng.newQObject(myObj));
qDebug() << eng.evaluate(
[INDENT][INDENT]"obj.enabled = true;\n"
"print('Enabled: ' + obj.enabled);\n"
"print('isEnabled: ' + obj.isEnabled());"
).toString();[/INDENT][/INDENT]
return 0;
}
//CLASS DECL
//USE THE Q_OBJECT macro
#include "main.moc"
int main(int argc, char **argv)
{
Q_UNUSED(argc)
Q_UNUSED(argv)
MyObject *myObj = new MyObject;
QScriptEngine eng;
eng.globalObject().setProperty("obj", eng.newQObject(myObj));
qDebug() << eng.evaluate(
[INDENT][INDENT]"obj.enabled = true;\n"
"print('Enabled: ' + obj.enabled);\n"
"print('isEnabled: ' + obj.isEnabled());"
).toString();[/INDENT][/INDENT]
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks