[Qt-interest] newQObject ValueOwnership

David Ching dc at remove-this.dcsoft.com
Mon Mar 8 03:17:36 CET 2010


"David Ching" <dc at remove-this.dcsoft.com> wrote in message 
news:hn1ero$ik4$1 at eple.troll.no...
> Hello, I am confused about QtScript ValueOwnership.  If the code is
>
> void initScripting(Myclass *myclass)
> {
>    QScriptValue myScriptValue = m_engine.newQObject(myClass);
>    m_engine.globalObject().setProperty("myclass", myScriptValue, 
> QScriptEngine::ScriptOwnership);
> }
>
> First, does ValueOwnership affect myClass or myScriptValue?

I have read further, and ValueOwnership affects myclass (the C++ class). 
myScriptValue (the QScriptValue) is apparently always garbage collected.

Thanks,
David
 




More information about the Qt-interest-old mailing list