Is it possible to register a QQmlComponent or a QML Component as a QML type?



  • The only documented QML type registration is limited to registering C++ types.

    Is it possible to register a QQmlComponent or a QML Component as a QML type so it can be used in QML sources?

    Currently, only the QML component has a documented createObject() function, QQmlComponent has it too but it is not documented, but that only allows the objects to be created imperatively. I would like to register a component so it can be used declaratively in QML sources.



  • I am trying something similar...

    it seems that qmlRegisterType accepts a URL to define the QQmlComponent file, and after that, the component will be accesible from QML if you import the URI on registration. (that is what i think, didnt give a try)

    I am looking how to register the QML component as a QMetaType... that seems harder.. or maybe impossible? Some other user can help?




Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.