Qt 6.11 is out! See what's new in the release
blog
how to convert js array to c++ vector?[solved]
General and Desktop
3
Posts
2
Posters
2.4k
Views
2
Watching
-
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,
UseQVariantListon 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 }