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

X is not a type when defining function parameters in Qml

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P1: Critical
    • 6.6
    • 6.6.1
    • QML: Compiler
    • None
    • Windows

    Description

      After switching from Qt 6.5.2 to Qt 6.6.1 I get "X is not a type" errors when Qml function parameter types are defined with custom types:

      #include <QQmlEngine>
      
      class GadgetTest
      {
          Q_GADGET
          QML_ANONYMOUS
          QML_VALUE_TYPE(vtmGadgetTest)
      public:
          GadgetTest();
      };
      Q_DECLARE_METATYPE(GadgetTest)
      
      function onGadgetSignal(s : vtmGadgetTest) { // Error: vtmGadgetTest is not a type
          console.log("Gadget: " + s);
      }
      
      function onGadgetSignal(s : GadgetTest) { // Error: GadgetTest is not a type
          console.log("Gadget: " + s);
      }
      
      function onGadgetSignal(s ) { // works
          console.log("Gadget: " + s);
      }
      

      I tried to create an example but the problem seems to happen only in my production project. Maybe someone faces the same problem?

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            Harald Meyer Harald Meyer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes