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

Operator instanceof doesn't work when url contains fragment (#)

    XMLWordPrintable

Details

    • All

    Description

      In both Qt 5 and 6 instanceof operator doesn't work in cases like in the example:

       

      import QtQuick 2.15
      import QtQuick.Controls 2.15
      
      ApplicationWindow {
          width: 640
          height: 480
          visible: true
      
          Text {
              text: "result: " + (loader.item instanceof MyButton)
          }
      
          Loader {
              id: loader
              source: "MyButton.qml#2"
          }
      }
       

       

      This behavior is especially problematic for hot reloading, where fragment part helps trick the cache and force the component to be reloaded from source.

      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
            michalc Michał Cieślak
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes