How to pass the Java script [var] from qml to .H/.CPP file
Hi,
I had fetched the list of products and stored in javascript var in main.qml. Now I want to pass the var to ListProduct.cpp.
How should I pass the var.
Code Snippets:
main.qml [in button click event]
var varResultArray;
varResultArray = idPortalSearchItems.results[1];
objHomeController.eveWriteXMLFile(varResultArray) //passing var from main.qml
ListProduct.h
----------------
Q_INVOKABLE bool eveWriteXMLFile(var ResultArray);//Showing the error.
Query: What i have to declare in the declaration of the method in LisProduct.h to receive the var as the parameter.
Thanks in advance.
Re: How to pass the Java script [var] from qml to .H/.CPP file
Assuming you get the data from C++ in the first place, why not just use the same data type?
Looks a lot like trying to make your life as hard as possible by artifically doing things in JavaScript instead of doing it in C++.
Cheers,
_
How to pass the javascript var from qml to CPP?
I want to pass the results which stored in javascript var from the main.qml to the writeXML.cpp.
I can see the count, the searchitems are fetched and want to write in XML format.
How can I achieve this.
Code snippet:
var varResultArray;
varResultArray = idPortalSearchItems.results[1];
Query:
How Can I pass it by Javascript var Ex:
objHomeController.eveWriteXMLFile(varResultArray ); //Passing an Js variable
writeXML.h
------------
What will be the datatype of the argument of the method?
Ex:
Q_INVOKABLE bool eveWriteXMLFile(??????? varResultArray ); //What will be the datatype?
Thanks In advance.