QScriptValue::toVariant can turn basic string and number types, as well as arrays and objects (associative arrays), into a QVariant.
There doesn't seem to be any corresponding way to construct a QScriptValue from a QVariant.
Is it hiding, or m开发者_开发百科issing?
http://qt-project.org/doc/qt-5/qscriptengine.html#newVariant
QScriptValue QScriptEngine::newVariant(const QVariant & value)
Creates a Qt Script object holding the given variant value.
If a default prototype has been registered with the meta type id of value, then the prototype of the created object will be that prototype; otherwise, the prototype will be the Object prototype object.
精彩评论