0

I have some QtScripts that need to operate on some C++ data. I already expose a number of variables via QScriptEngine::globalObject().setProperty(), but this only seems to work out of the box for simple data types and QStrings.

I've tried using QScriptEngine::newVariant(), but none of QVariant's member functions are exposed to the script engine.

Ideally I'd like to be able to convert the QStringList into a plain QtScript array and call native array functions on it. Is there any way to do this?

Chris
  • 17,119
  • 5
  • 57
  • 60
  • I've not actually started using Qt Script yet, but I do recall seeing [qScriptValueFromSequence](http://qt-project.org/doc/qt-4.8/qscriptengine.html#qScriptValueFromSequence) when trawling the docs - is it of any use here? – sam-w May 10 '12 at 14:42
  • Worked like a charm, if you post as an answer I'll accept. – Chris May 10 '12 at 14:53

1 Answers1

3

I reckon you're after qScriptValueFromSequence.

sam-w
  • 7,478
  • 1
  • 47
  • 77