-
Bug
-
Resolution: Done
-
P2: Important
-
5.0.0
-
None
-
Ubuntu
The attached .qml shows a nested ListView (id: section2), where the ListView is an imported component (ControlView.qml) ie.
ListView {
model: controlsmodel
...
}
VisualItemModel {
id: controlsmodel
ControlView {
id: section 2
controlname: "Phoenetic"
...
}
...
}
and, ControlView
ListView {
id: controlviewitem
property string controlname
header: Rectangle { Text { text: controlviewitem.controlname } }
footer: Rectangle { Text { text: controlviewitem.controlname } }
...
}
The property 'controlname' for the ControlView component cannot be accessed by the header/footer. Setting the text item to controlviewitem.controlname results in
ControlView.qml:15: ReferenceError: Can't find variable: controlviewitem
However, setting the header Text item to read the property from the main .qml component id i.e.
text: section2.controlname
seems to work - but obviously sets that for every following instance of the ControlView.
| For Gerrit Dashboard: QTBUG-21865 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 6199,1 | Fix ListView components being unable to access context properties. | master | qt/qtdeclarative | Status: MERGED | +2 | 0 |