spraff
spraff

Reputation: 33395

QScriptValue::toVariant but no fromVariant?

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 missing?

Upvotes: 3

Views: 946

Answers (1)

spraff
spraff

Reputation: 33395

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.

Upvotes: 2

Related Questions