title: How to access ListView's current item from qml
body: <p>I have an application that stores and edits notes. The list of notes is displayed in a listview like this:</p>
  
  <pre><code>Page {
          id: noteList
          title: i18n.tr("QNote")
          visible: false
  
          Column {
              anchors.fill: parent
  
              ListView {
                  anchors.fill: parent
                  model: notes
                  delegate: ListItem.Standard {
                      text: Title
                      onClicked: editNote(NoteText, Title, modelData);
                      progression: true
                  }
              }
          }
      }
  
  function editNote(text, title, item) {
      pageStack.push(noteEdit, {title: title, text: text});
      handler.setActiveItem(item);
  }
  </code></pre>
  
  <p>The notes item is a NoteListModel that subclasses the QAbstractListModel and contains NoteListItems. What I would like to do is to store the currently selected NoteListItem so I could easily access the Note object inside when the user wants to save the modified note. However, I don't know how to access the backing NoteListItem from the qml delegate. the modelData seems to be something else. Is there any way to do so? If i could wrap the Note object in a QVariant I could access it easily through roles but when I tried it like this</p>
  
  <pre><code>QVariant NoteListItem::data(int role) {
      switch (role) {
      case Title:
          return note.getTitle();
      case NoteText:
          return note.getText();
      case NoteObject:
          return QVariant::fromValue(note);
      default:
          return QVariant();
      }
  }
  </code></pre>
  
  <p>it resulted in a compiler error saying </p>
  
  <p>qmetatype.h:642: error: invalid application of 'sizeof' to incomplete type 'QStaticAssertFailure'</p>
  
  <p>Or should i try to access the selected list item from the backing code? Is there any way for that? Dou you have any ideas?</p>
  
  <p>Thanks for your time. Regards, 
  Peter</p>