How to display the avatar/picure associate with a contact in qml.



  • I want to display contact image(thumbnail or the avatar) for all the contacts.i am able to show the first Name, last Name and the phone Number of each contact.
    here is my code snippet.

    @import QtQuick 1.0
    import QtMobility.contacts 1.1

    Rectangle {
    width: 360
    height: 360
    //Model
    ContactModel {
    id : contactsmodel
    }
    //View
    ListView {
    id : list
    anchors.fill: parent
    model: contactsmodel.contacts
    //delegate
    delegate: Text { text: name.firstName +" "+ name.lastName +" : "+phoneNumber.number }
    }

    //MouseArea
    MouseArea {
        anchors.fill: parent
        onClicked: {console.log("MouseArea")}
    }
    

    }

    @



  • Now i can see the avatar of the contact in the left side of the contact list.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.