QML error when exposing child properties

I have a QML object that is 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
        }
    }
}

It does not hold: Invalid alias target location: internalImage.

However, if I do this:

Column {
    property alias source: internalImage.source
    property alias text: internalText.text

    Image {
        id: internalImage
    }

    Text {
        id: internalText
        width: internalImage.width
    }
}

Why is this?

+4
source share
1 answer

As from the documentation , the scope Component:

combining object identifiers inside components and properties of the component root element

, id, , id s.
, , / .

+3

All Articles