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

When relying on implicit PCH, QML_ELEMENT is not processed by qmltyperegistrar

    XMLWordPrintable

Details

    • fd88f44c1 (dev), 0f4cd43bc (6.9), c170381f3 (dev), aed070931 (6.8)

    Description

      See attached project. The CppObj class contains both Q_OBJECT and QML_ELEMENT. The relevant headers for those macros are precompiled but not explicitly #include-d.

      The Clang code model is happy with the C++ code (when using MSVC) and the project does not produce any compile-time errors. But, it contains runtime errors:

      • CppObj::metaObject() is implemented by moc and can be called in C++ (Expected)
      • CppObj is not registered as a QML type and is invisible to the QML engine (Not Expected)

       

      Workaround

      Explicitly #include-ing the PCH (or <qqmlintegration.h>) fixes the error.

      Attachments

        For Gerrit Dashboard: QTBUG-134148
        # Subject Branch Project Status CR V

        Activity

          People

            fabiankosmale Fabian Kosmale
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes