[Development] QTCS2019 Notes from QtQml session

Ulf Hermann ulf.hermann at qt.io
Tue Nov 26 08:56:44 CET 2019


> We have some code that evaluates JS in custom QQmlContexts with certain
> "magic" context properties set (sort of like the "index" or "modelData"
> context properties in delegates like Repeater.delegate).
> Will something similar still be possible?

You should rephrase that as required properties on actual objects. Then 
the magic won't work anymore and you'll have to look up the properties 
by ID of the object, but that is a good thing. It will improve 
re-usability of your components.

We're also changing the way views and delegate work. If you want to use 
the "index" in a Repeater's delegate you'll have to declare that in QML 
3, using a required property:

Repeater {
     model: 10

     Text {
         required property int index
         text: "item " + index
     }
}


More information about the Development mailing list