How to import the contacts details from the phone memory and sim memory ?

  • Hi all,
    I am trying to import the contacts from the phone and sim memory using QML.I had almost achieved it but i am in need of some help.

    This is my coding:
    import QtQuick 1.0
    import 1.0
    import QtMobility.contacts 1.1

    Page {
    id: mainPage

     Text {
         id: title
         x: 130
         y: 0
         width: 101
         height: 36
         text: "Contacts" "Times New Roman"
         anchors.horizontalCenterOffset: 1
         font.pointSize: 10
         anchors.horizontalCenter: parent.horizontalCenter
         anchors.topMargin: 0
         color: platformStyle.colorNormalLight
     ListView {
         id: mainList
         anchors.left: parent.left
         anchors.leftMargin: 3
         anchors.right: parent.right
         anchors.rightMargin: 3 title.bottom
         anchors.bottom: parent.bottom
         anchors.topMargin: 3
         cacheBuffer: 100
         clip: true
         highlightFollowsCurrentItem: true
         snapMode: ListView.SnapOneItem
         model: contactModel.contacts
         delegate: listDelegate
         ContactModel {
             id: contactModel
            manager: "symbiansim" // "symbian" for other contact manager
            autoUpdate :true
                 SortOrder {
                     detail: ContactDetail.Name
                     field: Name.LastName
                     direction: Qt.AscendingOrder
         Component {
             id: listDelegate
             ListItem {
                 id: contactItem
                 subItemIndicator: true
                 ListItemText {
                     id: nameItem
                     mode: contactItem.mode
                     role: "Title"
                     text: displayLabel
         ScrollDecorator {
             flickableItem: mainList


    From my code i am able to get the contacts from the phone as well as sim memory in a list view and i am able to scroll the list too.

    But what is the problem is:when i select any one of the contacts from the list it doesnt display the details as name,mobile number, remains as such when i select those items

    Can anyone help me with this?
    I also tried to do something like this:
    ListView {
    id: mainList
    anchors.fill: parent
    model: ContactModel {}
    delegate: Text {
    text: "Name: " + + " " + + " Number: " +
    but i dont know how to add this or this one is right anyone help me out?

  • [Solved]

    I finished it on my own with the second code i had suggested

Log in to reply

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