[Qt-interest] How to copy a QScriptValue ?
mario
dodiesis at gmail.com
Mon Jan 10 14:18:29 CET 2011
2011/1/8 Tony Rietwyk <tony.rietwyk at rightsoft.com.au>:
>> 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);
>>
yes, you right.. but it was a cut&paste mistake...
in the end seems that
QMap<QString, QVariant> m;
m["1"] = "one";
m["2"] = "two";
m["3"] = "three";
m["4"] = "four";
QVariant v(m);
QScriptValue sv = engine.newVariant ( v )
engine.globalObject().setProperty("globalStuff", sv);
is not enough to create an obj as expected.
I do not understand if the newVariant function is the right one for me.
Regarsd,
Mario
More information about the Qt-interest-old
mailing list