Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

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

    QML and Qt Quick
    3
    3
    657
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I
      iter last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • B
        bnogal last edited by

        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?

        1 Reply Last reply Reply Quote 0
        • D
          devel last edited by devel

          Looks like a recent question on StackOverflow (no solution so far):

          http://stackoverflow.com/questions/34814738/resolve-qml-types-using-a-custom-mechanism#comment57421466_34814738

          1 Reply Last reply Reply Quote 0
          • First post
            Last post