Details
Description
The following code illustrates how the "new" Binding syntax fails to cross component boundaries. Workaround is to use the "old" syntax.
pragma ComponentBehavior: Bound import QtQuick Window { id: root width: 640 height: 480 visible: true title: qsTr("Hello World") property int foo Text { text: `Foo: ${root.foo}` } Repeater { model: 1 delegate: Item { id: delegate // Error: QML Binding: Unknown name "root.foo". The binding is ignored. Binding { root.foo: 42 } // Works // Binding { // target: root // property: "foo" // value: 42 // } } } }
Attachments
For Gerrit Dashboard: QTBUG-134778 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
638810,2 | QtQml: Fix context traversal in QQmlProperty | dev | qt/qtdeclarative | Status: MERGED | +2 | +1 |
639086,2 | QtQml: Fix context traversal in QQmlProperty | 6.9 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
639157,2 | QtQml: Fix context traversal in QQmlProperty | 6.8 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
639183,3 | QtQml: Fix context traversal in QQmlProperty | tqtc/lts-6.5 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |