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

Foreign generation fails with namespace

    XMLWordPrintable

Details

    • fa081b89f0bf8813e11d00436ab0dc9fb5efb378, a6e6cb781 (dev), 8b62cbc0f (6.7), 11fecaea0 (6.6), a91ee395b (tqtc/lts-6.5)

    Description

      As found in QTBUG-123542 the code example in attached project cannot compile because the type is in a separate namespace.
       
      base_enum.h

      namespace stuff
      {
      class A
      {
      	Q_GADGET
      	Q_CLASSINFO("QML.Element", "flupp")
      	public:
      	enum class Flupp {
      		Flipp = 44
      	};
      	Q_ENUM(Flupp)
      };
      }
      
      [40/62] Automatic QML type registration for target ui_qml
      Warning: ui_base_ui_qml.h:: A is declared as foreign type, but cannot be found.
      [49/62] Building CXX object CMakeFiles/ui_qml.dir/ui_base_ui_qml.cpp.o
      FAILED: CMakeFiles/ui_qml.dir/ui_base_ui_qml.cpp.o 
      /usr/bin/clang++ -DQT_CORE_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_QMLBUILTINS_LIB -DQT_QMLINTEGRATION_LIB -DQT_QML_LIB -I/tmp/o -I/home/andre/hg/QmlDummy -I/tmp/o/ui_qml_autogen/include -I/home/andre/hg/QmlDummy/base -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQml/6.7.0 -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQml/6.7.0/QtQml -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtCore/6.7.0 -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtCore/6.7.0/QtCore -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtCore -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/mkspecs/linux-g++ -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQmlBuiltins/6.7.0 -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQmlBuiltins/6.7.0/QtQmlBuiltins -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQmlBuiltins -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQml -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQmlIntegration -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtNetwork -fPIC -MD -MT CMakeFiles/ui_qml.dir/ui_base_ui_qml.cpp.o -MF CMakeFiles/ui_qml.dir/ui_base_ui_qml.cpp.o.d -o CMakeFiles/ui_qml.dir/ui_base_ui_qml.cpp.o -c /tmp/o/ui_base_ui_qml.cpp
      In file included from /tmp/o/ui_base_ui_qml.cpp:1:
      /tmp/o/ui_base_ui_qml.h:9:17: error: unknown type name 'A'; did you mean 'stuff::A'?
          9 |     QML_FOREIGN(A)
            |                 ^
            |                 stuff::A
      /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQmlIntegration/qqmlintegration.h:156:28: note: expanded from macro 'QML_FOREIGN'
        156 |     using QmlForeignType = FOREIGN_TYPE; \
            |                            ^
      /home/andre/hg/QmlDummy/base/base_enum.h:20:7: note: 'stuff::A' declared here
         20 | class A
            |       ^
      1 error generated.
      [50/62] Building CXX object CMakeFiles/ui_qml.dir/ui_qml_qmltyperegistrations.cpp.o
      FAILED: CMakeFiles/ui_qml.dir/ui_qml_qmltyperegistrations.cpp.o 
      /usr/bin/clang++ -DQT_CORE_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_QMLBUILTINS_LIB -DQT_QMLINTEGRATION_LIB -DQT_QML_LIB -I/tmp/o -I/home/andre/hg/QmlDummy -I/tmp/o/ui_qml_autogen/include -I/home/andre/hg/QmlDummy/base -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQml/6.7.0 -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQml/6.7.0/QtQml -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtCore/6.7.0 -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtCore/6.7.0/QtCore -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtCore -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/mkspecs/linux-g++ -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQmlBuiltins/6.7.0 -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQmlBuiltins/6.7.0/QtQmlBuiltins -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQmlBuiltins -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQml -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQmlIntegration -isystem /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtNetwork -fPIC -MD -MT CMakeFiles/ui_qml.dir/ui_qml_qmltyperegistrations.cpp.o -MF CMakeFiles/ui_qml.dir/ui_qml_qmltyperegistrations.cpp.o.d -o CMakeFiles/ui_qml.dir/ui_qml_qmltyperegistrations.cpp.o -c /tmp/o/ui_qml_qmltyperegistrations.cpp
      In file included from /tmp/o/ui_qml_qmltyperegistrations.cpp:11:
      /tmp/o/ui_base_ui_qml.h:9:17: error: unknown type name 'A'; did you mean 'stuff::A'?
          9 |     QML_FOREIGN(A)
            |                 ^
            |                 stuff::A
      /home/andre/hg/AusweisApp2-build/libs/67/dist/include/QtQmlIntegration/qqmlintegration.h:156:28: note: expanded from macro 'QML_FOREIGN'
        156 |     using QmlForeignType = FOREIGN_TYPE; \
            |                            ^
      /home/andre/hg/QmlDummy/base/base_enum.h:20:7: note: 'stuff::A' declared here
         20 | class A
            |       ^
      1 error generated.
      [52/62] Building CXX object CMakeFiles/ui_qml.dir/.rcc/qmlcache/ui_qml_qmlcache_loader.cpp.o
      ninja: build stopped: subcommand failed.
      LANG=C.utf8 ninja  14,93s user 0,95s system 622% cpu 2,550 total
      
      #ifndef ui_base_ui_qml_H
      #define ui_base_ui_qml_H
      #include <QtQml/qqml.h>
      #include <QtQml/qqmlmoduleregistration.h>
      
      #include <base_enum.h>
      struct AForeign{
          Q_GADGET
          QML_FOREIGN(A)
          QML_NAMED_ELEMENT(flupp)
      };
      
      #endif
      

      QmlDummy.tar.gz

      Attachments

        1. QmlDummy.tar.gz
          2 kB
          André Klitzing

        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
              misery André Klitzing
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes