So I have this code:
QScriptValue result(someFunction());
if(result.isArray()) {
{
// Print items in array
}
How can I do it? I tried to convert it to QList<QScriptValue>
but that doesn't work. I considered doing this:
const int length = (int)result.property("length").toNumber();
for (int i = 0; i < length; ++i) {
const QSCriptValue entry(result.property(QString::number(i)))));
// do something with entry
}
It works but seems kinda ugly.
Based on
QScriptValue
help, probably something like:Needs testing to see if it actually.