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

QML type registration creates warning when using generated source files

    XMLWordPrintable

Details

    • Windows

    Description

      Attached you will find a sample project to demonstrate the issue.

      In a cmake project, I use "qt_add_repc_replicas()" to generate a QRO replica class from a ".rep" template file.

      In another header file (myclass.h), I reference the generated class with the aim to expose the generated class' enum "MyEnum" through QML_FOREIGN_NAMESPACE.

      When building, QML tooling ("Automatic QML type registration for target ...") generates a warning:

      Warning: myclass.h:: MyQroReplica is declared as foreign type, but cannot be found. 

      (Remember: when  using Qt Creator, to see the warning in its "Compile Output" console, you have to set "

      QT_ASSUME_STDERR_HAS_CONSOLE=1" for your "Build Environment")

       

      When I put a copy of the generated replica header file into the source tree and add the file to the project, I do not receive the warning.

       

      I even tried to generate the replica header file via a separate target and explicitly add the generated header file (from the build directory) to my qml module target. The warning is still there.

       

      You may try the above mentioned setups by modifying the COMPILE_VARIANT variable in the attached projects CMakeLists.txt file.

       

      # Original: replica header file is generated and added to target
      # Warning: yes
      set(COMPILE_VARIANT "Original")
      
      # Source: project uses a copy of the replica header file from the source tree
      # Warning: no
      # set(COMPILE_VARIANT "Source")
      
      # Source: project builds the replica header file in a separate target which is
      #         then used and linked by the qml module target
      # Warning: yes
      # set(COMPILE_VARIANT "Build")
       

      Attachments

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

        Activity

          People

            qtbuildsystem Qt Build System Team
            vertigo Christian Poms
            Votes:
            7 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes