PDA

View Full Version : Scripting question



EricF
30th January 2008, 19:50
I try to use Qt Script module to trigger some slots in my application for testing purpose and I have a slot which takes a QVector<QVariant> as arguments. My question is how can I send these parameters from the script ?

I tried this script:


var myArray = ["String", 0];
myObject.mySlot(myArray);

Then my slot gets called but the QVector is empty.

I tried Q_DECLARE_METATYPE(QVector<QVariant>) and qScriptRegisterSequenceMetaType<QVector<QVariant> >(engine) and I can't even compile it. I get this error :


error C2039: 'qt_metatype_id' : is not a member of 'QMetaTypeId<T>'
with
[
T=QVariant
]

How can I do this ?

wysota
31st January 2008, 02:25
Use QVariantList. It's an alias for QList<QVariant>.

EricF
31st January 2008, 15:54
I should have updated it yesterday. That's what I finally did. :D