instantiate c++ struct in qml js functions

170 Views Asked by At

how can initial an object from a c++ struct and send them to c++ class like this :

//c++
struct sRange
{
float min;
float max;
};
qmlRegisterType<sRange>("sRange", 0, 1, "sRange");


//QML
import sRange 0.1
function newRange()
{
 sRange range;
 range.min = 10 ;
 range.max = 20 ;

 cppClassObject.newRange(range); // cppClassObject -> registered property context
}

in above code we create and instance from sRange and set to newRange method in c++ class.but we can not instantiate an object from sRange struct tnx

0

There are 0 best solutions below