Passing QML component to C++ function
Hello
http://doc.qt.io/qt-4.8/qml-component.html
I have a Q_INVOKABLE C++ function which must receive one QML component as a parameter.
What should be the parameter type of the C++ function?
When inside the C++ function, how to access the individual properties of the QML component?
Any example?
Thanks;
Mut
Re: Passing QML component to C++ function
Do you mean a component or an object?
I.e. is the QML side a Component or e.g. a QQuickItem type?
Also: what do you need this for? Very often "accessing QML from C++" means there are better ways of achieving the same result
Cheers,
_
Re: Passing QML component to C++ function
Thanks for the reply.
The QML side is a Component.
I want to store the component or a pointer to it in my c++ class and later give it back to QML upon request.
I also wondering what should be the signature of second function i.e. the one which allow QML side to get the component?
Mut
Re: Passing QML component to C++ function
The C++ class for the QML Component type is QQmlComponent.
So a property of type QQmlComponent* should work.
Cheers,
_