PDA

View Full Version : QVariantList from QScript?



musla
29th June 2009, 11:22
Hi all,

I have an C++ object exposed to QScript interface (as MyObject*). That object has an method accepring QVariant variable. How can I submit a QVariantList from QScipt?
Something like:

//obj = MyObject*
var a = new Array("one","two","three");
obj.someMethod(a);

Where someMethod is defined as public slot someMethod(QVariant);
Currently the Array "a" evaluates in C++ Qvariant holding type QString. But I would like to have it as QVariantList. Do I need to add more conversion functions to the scripting engine? I would expect this as default behaviour....

In other words according to the QT docu - how can I make the script variable "a" that behaves as QScriptValue array? Then it should be converted to QVariantList (when converting from script to C++) and accepted as QVariant (The QVariantList as parameter of the method).