Passing pointer to custom QML Type?
-
I have a "service" class that supplies whatever object the information they need. I'm not sure if I'm thinking this right, but the main idea is to have my custom QML type, let's call it
Message
to obtain the pointer before I useqmlRegisterType
so it has said pointer and I don't have to write:Message { id: something data: serviceProvider (service class, of course) messageId: <int> }
Over and over again.
That said I just couldn't see any way of doing this, although the other way I found would be injecting the
service
into the rootContext in which I'm not exactly fond of the idea but if that's the only way then I guess I shall abide.Any thoughts, ideas?
-
Not quite understand your question, but seems that what you are looking for should be Singleton object.
-
This could be an strating point: