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

X is not a type when defining function parameters in Qml

XMLWordPrintable

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

      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?

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes