[Solved] viewer.engine()->rootContext()->setContextProperty(...) - main.cpp:41: error: C2248: 'QVariant::QVariant' : cannot access private member dec
We are trying to pass the following object to .qml
Brand *tmpBrand = new Brand("45678","Sprite.png","0");
We encounter error "main.cpp:41: error: C2248: 'QVariant::QVariant' : cannot access private member declared in class 'QVariant' " and unable to proceed further.
However, the following makes us move ahead with no problem
But, the object "brand" does not have required member values. We intend to update the values and use the newly create object using "Brand *tmpBrand"
Is there any other work around to pass currently updated object to my .qml file for UI presentation.
Any quick answer helps us in great way.
Looking at the setContextProperty doc, it should rather be something like:
Brand tmpBrand("45678", "Sprite.png", "0");
Otherwise you would be passing a pointer to a pointer to a Brand object.
Thanks. Its working and saved my day.
You're welcome !
Don't forget to update the thread's title to solved (prepending it) so other forum users will know that a solution has been found :)