title: QML states does not work
body: <p>Okay so here is the QML, what I want to do is that if an element is the current item that the box get big.</p>
  
  <pre><code>import QtQuick 2.0
  
  Rectangle {
  width: 300; height: 200; color: "white"
  
  ListModel {
      id: nameModel
      ListElement { name: "Alice"; }
      ListElement { name: "Bob";  }
      ListElement { name: "Jane"; }
      ListElement { name: "Harry";  }
      ListElement { name: "Wendy";  }
  }
  
  Component {
      id: nameDelegate
      Item {
          id: delegateItem
          width: parent.width
  </code></pre>
  
  <p>Here I try this:</p>
  
  <pre><code>states: [
              State {
                  name: "current"
                  when: ListView.isCurrentItem
                  PropertyChanges { target: delegateItem; height: 44 }
              },
              State {
                  name: "not"
                  when: !ListView.isCurrentItem
                  PropertyChanges { target: delegateItem; height: 26 }
              }]
          state: "not"
  
          Text {
              text: name
              font.pixelSize: parent.height - 4
              anchors.left: parent.left
              anchors.verticalCenter: parent.verticalCenter
  </code></pre>
  
  <p>Here I do something similair to verify if it works, it does work:</p>
  
  <pre><code>            color: delegateItem.ListView.isCurrentItem ? "red" : "black"
          }
      }
  }
  
  ListView {
      id: listView
      anchors.fill: parent
  
      model: nameModel
      delegate: nameDelegate
      focus: true
      clip: true
  
      header: Rectangle {
          width: parent.width; height: 10;
          color: "#8080ff"
      }
      footer: Rectangle {
          width: parent.width; height: 10;
          color: "#8080ff"
      }
      highlight: Rectangle {
          width: parent.width; height: 10;
          color: "lightgray"
      }
  }
  }
  </code></pre>
  
  <p>Now I am wondering what is wrong, I know that <code>ListView.isCurrentItem</code> changes because 
  I see that letters turn red when selected. </p>
  
  <p><img src="https://i.stack.imgur.com/BwoN5.png" alt="See letters turn red, but box doesn&#39;t grow"></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The answer that jbh gave me was a good one. After which I changed <code>ListView.isCurrentItem</code> to <code>delegateItem.ListView.isCurrentItem</code> and it worked. This is because you can't access <code>isCurrentItem</code>  form the state, but if you go to <code>delegateItem</code> it does work.</p>