1、qml
function readValues(anArray, anObject) { for (var i = 0; i < anArray.length; i++ ) console.log("Array item:", anArray[ i ]) for (var prop in anObject) { console.log("Object item:", prop, "=", anObject[prop]) } }
2、C++
QVariantList listY; listY << 2 << 4 << 4.5 << 5 << 8 << 12 << 18; QMetaObject::invokeMethod(qw->rootObject(), "setValue",
Q_ARG(QVariant,QVariant::fromValue(listY)),
Q_ARG(QVariant,QVariant(info)));