how to convert js array to c++ vector?[solved]
-
hi,
I want to invoke a c++ function from a js function and I want that the c++ function will get the array that was declared in the js file..
there is anybody who know how can I do it?thanks!
Hi @LeaA,
UseQVariantList
on C++ side. Eg:// JavaScript side: var cars = ["Saab", "Volvo", "BMW"]; obj.getJsArray(cars) // getJsArray is a Q_INVOKABLE function on C++ side //C++ side void MyClass::getJsArray(QVariantList list) { qDebug() << list; //Use toVector() to convert it to vector }