Registering created object in qmlRegisterType<T>. How?
-
Hello all!
Got a question about registering created object like QML component after few actions:
QMLCustomComponent *oQMLCustomComponent = new QMLCustomComponent(); oQMLCustomComponent->doMethod1(); oQMLCustomComponent->doMethod2(); oQMLCustomComponent->doMethod3(); qmlRegisterType<oQMLCustomComponent>("Custom.Component",1,0,"CustomComponent");
I need to register created object after few actions in QML Engine. Is it possible to do it? If yes how?
-
Registered that way and created at QML component
CustomComponent
will be just another istance of yourQMLCustomComponent
class. If you want to use exactlyoQMLCustomComponent
you must set it as context property. Also you can read about registering singletons via C++. -
Registered that way and created at QML component
CustomComponent
will be just another istance of yourQMLCustomComponent
class. If you want to use exactlyoQMLCustomComponent
you must set it as context property. Also you can read about registering singletons via C++.@intruderexcluder Here the thing - I need component itself but not context of component. The next idea that I got about it to use OOP Builder template that will be checking parameters automatically and run methods at time of construction of the object.