Access to children components inside a custom component



  • I've make a custom component that is composed by others custom components.
    Now when I use this component I need to access to the instaces of the children components. It is possible?



  • Excuse me, I wrote "custom module" instead of "custom component"
    (The post is now correct)
    Thanks



  • Oh accessing children in a component is much easier :D

    the way I use is just setting an alias property that works well, e.g.
    (CompA.qml)
    @
    Item {
    property alias textItem: textId // item alias
    property alias text: textId.text // single property alias
    Text { id: textId }
    }
    @
    now you can access the Text item from outside:
    (in another QML file)
    @
    CompA {
    textItem.text: "foo"
    //or text: "foo" is this case
    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.