Reputation: 575
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
Upvotes: 0
Views: 175