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

instanceof don't work with inline components

    XMLWordPrintable

Details

    • b48bb41681f561b59a4ce9c9d0ac95b23d5ccb1e

    Description

      Code bellow if I run it with qml from Qt 6.3.1 prints:

      qml: is foo Item:  true
      qml: is foo Foo:  false
      qml: is boo Boo:  true
      

      Expected result that "foo instanceof Foo" is true,
      while actual result is false.

      main code:

      import QtQuick
      
      Item {
         component Foo : Item {
              property int a: 17
         }
         Foo {
              id: foo
              a: 15
         }
         Boo {
              id: boo
              b: 3
         }
         Component.onCompleted: {
              console.log("is foo Item: ", foo instanceof Item);
              console.log("is foo Foo: ", foo instanceof Foo);
              console.log("is boo Boo: ", boo instanceof Boo);
         }
      }
      

      Boo.qml

      import QtQuick
      
      Item {
         property int b: 17
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              olivier.decanniere Olivier De Cannière
              evgeniy_dushistov evgeniy_dushistov
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes