QtScript access variable from C++
Hey there,
I'm using QtScript on Qt 4.4.
I have the following scenario:
Code:
main.prototype.body = function()
{
box = new qkBox;
box.show();
}
qkBox is a QObject.
How can I access this variable from C++ ?
Can I get an array of all QObjects newed inside the script process ?
Thanks.
Re: QtScript access variable from C++
Sometimes I feel like docs reading service, but here it goes: Making a QObject-based Class New-able from a Script :)
Re: QtScript access variable from C++
Since you are creating the box as global you should be able to get it after script evaluation somewhat as:
Code:
QObject* box
= engine
->globalObject
().
property("box").
toQObject();