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

Model data is not available if sourceItem is defined outside Loader

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.2.0 Beta1
    • Quick: Other
    • None
    • Windows

      If elements of a Column are created via Loader, the loader sourceItem has to be defined inside the Loader scope. If it is defined outside, via a property, index and other model properties are not accessible inside the delegate.
      See the attached example. Working version is commented.
      The working version gives no possibility to define the delegate outside of the component.

      UPD:
      I found in description that it was deliberately made to work this way.
      The documentation misses description how to:
      1) pass through all properties of QAbstractListModel if they can't be explicitly defined inside Loader. If I have, for instance, a rolename "node "defined in the model, when I try to access it inside the delegate, it shows "ReferenceError: node is not defined"
      2) manually set Loader as the context object for the component it is loading.

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            alexey89 alexey89
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes