[Qt-interest] How to copy a QScriptValue ?

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Sat Jan 8 03:36:11 CET 2011


Mario wrote:

> -----Original Message-----
> Sent: Saturday, 8 January 2011 03:58
...
> To retreive the value:
> QScriptValue globalShared = global.property("xyz");
> QVariant m_sSharedDatas = globalShared.toVariant();
> 
> To recreate the value:
> QScriptEngine engine;
> QScriptValue sharedVal = engine.newVariant ( m_sSharedDatas );
> engine.globalObject().setProperty("xyz", globalShared);
> 
> I can see the sSharedDatas filled with all my values, but when in the
> second engine I try to access to the new xyz variable, I always have
> "undefined".
> What am I missing?
> Tnx all,
> Mario

I've never used the script engines, but assuming the QScriptValue's are
private to each engine, I think you need:

	engine.globalObject().setProperty("xyz", sharedVal);

Tony. 




More information about the Qt-interest-old mailing list