[Qt-interest] newQObject ValueOwnership
David Ching
dc at remove-this.dcsoft.com
Mon Mar 8 01:03:02 CET 2010
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? The doc is
vague whether it affects ownership of the C++ object, or the QScriptValue
wrapping that C++ object. My situation is myClass exists for the lifetime
of the app, but myScriptValue needs to exist only for the lifetime of the
script engine (m_engine), and I would like myScriptValue to be deleted
automatically when m_engine is destroyed.
Thanks,
David
More information about the Qt-interest-old
mailing list