title: How to get id of child in qml
body: <p>When I tried to get children ID's slightly modifying this <a href="http://qmlbook.github.io/en/ch01/index.html" rel="noreferrer">http://qmlbook.github.io/en/ch01/index.html</a> example</p>
  
  <pre><code>// animate.qml
  
  import QtQuick 2.0
  
  Item 
  {
      id: root
      width: background.width
      height: background.height
      property string information: "this is root"
  
      property int rotationStep: 45
  
      Image {
          id: background
          source: "images/background.png"
      }
  
      Image {
          id: pole
          property string information: "this is pole"
          x: (root.width - width)/2+2
          y: root.height - height
          source: "images/pole.png"
      }
  
      Image {
          id: pinwheel
          anchors.centerIn: parent
          source: "images/pinwheel.png"
          property string information: "this is pinweel"
          // visible: false
          Behavior on rotation {
              NumberAnimation { duration: 125 }
          }
      }
  
      Image {
          id: blur
          opacity: 0
          anchors.centerIn: parent
          source: "images/blur.png"
           property string information: "this is blur"
          // visible: false
          Behavior on rotation {
              NumberAnimation { duration: 125 }
          }
          Behavior on opacity {
              NumberAnimation { duration: 125 }
          }
  
      }
  
      // M1&gt;&gt;
      focus: true
      Keys.onLeftPressed: {
          blur.opacity = 0.8
          pinwheel.rotation -= root.rotationStep
          blur.rotation -= root.rotationStep
      }
      Keys.onRightPressed: {
          blur.opacity = 0.5
          pinwheel.rotation += root.rotationStep
          blur.rotation += root.rotationStep
      }
      Keys.onReleased: {
          blur.opacity = 0
      }
  
      Keys.onSpacePressed:
      {
          for (var i=0; i&lt;root.children.length; ++i)
              console.info(root.children[i].information)
      }
  
      Keys.onDeletePressed:
      {
          for (var i=0; i&lt;root.children.length; ++i)
              console.info(root.children[i].id)
      }
  
  
      // &lt;&lt;M1
  }
  </code></pre>
  
  <p>Unfortunately  pressing Delete key gives me an error: </p>
  
  <pre><code>qml: undefined
  qml: undefined
  qml: undefined
  qml: undefined
  </code></pre>
  
  <p>as opposed to pressing spacebar:</p>
  
  <pre><code>qml: undefined
  qml: this is pole
  qml: this is pinweel
  qml: this is blur
  </code></pre>
  
  <p>Why this script returns undefined id's ?</p>
  
  <p>I need to traverse some objects and be able to tell what is what - so I need to know how to traverse root tree to get id's of its childs and their object types.</p>
  
  <p>Unfortunately I was unable to print the most trival id's and had to add some simple property to get it done but this means a lot of work in real life project since every object needs information property :(</p>
  
  <p>So to reiterate: </p>
  
  <ol>
  <li>Why the id's in this example are undefined?</li>
  <li>How to traverse object tree using qml and print its id's and types ?</li>
  </ol>