Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.5.0 Beta1
-
None
Description
I have a repeater which uses a list of JS objects as a model.
I was using modelData.property to access the elements of the JS object before.
Now I try to switch to using required properties:
Repeater { model: [ {"inUse": false, "azimuth": 123, "elevation": 35, "identifier": 10}, {"inUse": true, "azimuth": 278, "elevation": 67, "identifier": 11}, ] delegate: Rectangle { required property bool inUse required property real azimuth required property real elevation required property int identifier width: 30 height: width radius: width / 2 color: inUse ? root.inUseColor : root.inViewColor visible: azimuth > -1 && elevation > -1 property real angle: (azimuth - 90) / 180 * Math.PI property real distance: root.maxCircleRadius * (90 - elevation) / 90 x: root.centerX + distance * Math.cos(angle) - width / 2 y: root.centerY + distance * Math.sin(angle) - height / 2 Text { anchors.centerIn: parent text: identifier } } }
With this code I get the "Required property <name> was not initialized" error for every property.
The solution for now is to use
required property var modelData
and go back to accessing all the elements using it.