Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Access item in ListView's delegate



  • I have a signal and ListView:

       signal userEdited(User user)
    
        ListView {
            delegate: userListDelegate
            model: userList
        }
    

    and then the delegate component which contains button:

    Component {
          id: userListDelegate
          Button{
            onClicked: {
                // here I want to emit signal with a user which is represented by the delegate
                //emit buttonClicked()
           }
          }
    }
    

    On button click, I want to emit the signal, however I don't know how to access the whole user object of the delegate and pass it as the signal's parameter.


Log in to reply