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

Loader and ComponentBehaviour Bound seem incompatible

    XMLWordPrintable

Details

    • 6acf343acb (qt/qtdeclarative/dev) 6acf343acb (qt/tqtc-qtdeclarative/dev)

    Description

      Trying to fix unqualified access in Repeater elements, makes the warnings disappear completely. But if you're using a Loader in the same file, it breaks at runtime:

      pragma ComponentBehavior: Bound
      import QtQuick
      
      Window {
          id: root
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          property int count: 5
      
          Column {
              Loader {
                  sourceComponent: Item {}
              }
      
              Repeater {
                  model: root.count
      
                  Text {
                      id: item
                      required property int index
                      text: "Item: " + item.index + "/" + root.count
                  }
              }
          }
      }
      

      That results in

      qrc:/untitled/main.qml: Cannot instantiate bound component outside its creation context
      

      . I left in the Repeater, as that was what I wanted to fix, but it's not needed to run into the message.

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            cajus Cajus Pollmeier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes