I have a QML object defined as follows:
Item {
property alias source: a.internalImage.source
property alias text: a.internalText.text
Column {
id: a
Image {
id: internalImage
}
Text {
id: internalText
width: internalImage.width
}
}
}
This fails with: Invalid alias target location: internalImage.
However, if I do:
Column {
property alias source: internalImage.source
property alias text: internalText.text
Image {
id: internalImage
}
Text {
id: internalText
width: internalImage.width
}
}
Why is that?
As from the documentation, the scope of a Component is:
the union of the object ids within the component and the component's root element's properties
So, the outer element is not allowed to access to the ids contained in the inner element by means of a chain of ids.
On the other side, if you explicitly export a bunch of parameters by means of a set of variables, those values/references are freely available to the outer component.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With