Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-123052

Declarative type registration with superclass from external library

    XMLWordPrintable

Details

    Description

      I have a class B that I want to declarativly expose to QML. B is a subclass of A.

       

      #include <a.h>
      
      class B : public A {
        Q_OBJECT
        QML_ELEMENT
      };
      

      A is defined in a separate library that is installed into system dirs

       

      class A : public QObject {
        Q_OBJECT
      }
      

      When building my project I get
      Warning: b.h:: A is used but cannot be found.

      Looking into the generated qmltypes file B has type information, but is missing all the inherited properties/signals/invokables from A.

      I suspect the answer here is to call qt_extract_metatypes() on the library where A is defined. But that will add the metatypes file to the build directory of that library, which doesn't make it available when building the project that contains B. For that it would need to be installed to the system as part of the library's installation process, but as far as I can tell that doesn't happen and there seems to be no API to do that.

       

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtqmlteam Qt Qml Team User
              nicolasfella Nicolas Fella
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes