Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Access to children components inside a custom component
Forum Updated to NodeBB v4.3 + New Features

Access to children components inside a custom component

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    andrea993.93
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andrea993.93
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • X Offline
        X Offline
        Xander84
        wrote on last edited by
        #3

        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
        }
        @

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved