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

Required properties of delegates are null when not using "var"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.2.1
    • None
    • Linux/X11

    Description

      When using delegates with "required" properties, instead of relying on context properties, and a property is a QML type, the property is null if the propert type is used. If one uses "var", the property will be set correctly:

       

      component TestItem : QtObject {
      
      }
      Component {
       id: component
       TestItem {
        property string text: "hello!!"
       }
      }
      ListView {
       id: list
       anchors.fill: parent
       delegate: Text {
        // if type is changed to 'var', it works!! Otherwise 'item' stays null!?
        required property TestItem item
        text: item.text
        height: 100
       }
       model: ListModel {
        id: testModel
       }
       Component.onCompleted: {
        testModel.append({ item: component.createObject(null, {}) })
       }
      } 
      

       

       

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            jschaubzes Johannes Schaub
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes