Thanks for the suggestion, you are correct that if the setValues function takes a QVector<qreal>, there is no problem. However in my case the setValues function (which is actually in another class than the getValues function in the real application) needs to be able to take generic arrays, not just qreals. Changing the signature to setValues(const QVariant& variant) solved the problem, I can convert to a QVariantList using variant.value<QVariantList>() (not variant.toList(), which gives an empty list again.) But really, should there not be an error of some kind if I call a function with the wrong argument type?
(Edited after I realized I had a Q_PROPERTY(QVariantList values WRITE setValues ...) which would "convert" the array into an empty list even though I used a QVariant argument in setValues...)
Bookmarks