[SOLVED] Displaying list of contacts on Symbian phone

  • Trying to display list of contacts on Symbian Anna / Belle phone with this code:

    @import QtQuick 1.1
    import QtMobility.contacts 1.1

    ListView {
    width: 180; height: 200

     model: ContactModel {}
     delegate: Text {
         text: name + ": " + number


    I'm getting "ReferenceError: Can't find variable: name" errors (and same for number) when running this on device. I sort of remember that this used to work. But not anymore. Wonder what might be wrong.

  • Hi,

    name is of type "Name":http://doc.qt.nokia.com/qtmobility/qml-name.html

    you should use, for example:

    text: name.firstName + ": " + phoneNumber.number

  • Good point. But still no luck:

    @Component {
    id: contactDelegate
    Item {
    width: 180; height: 40
    Column {
    Text { text: '<b>Name:</b> ' + name.firstName }
    Text { text: '<b>Number:</b> ' + phoneNumber.number }

             ListView {
                 anchors.fill: parent
                 model: ContactModel {}
                 delegate: contactDelegate
                 highlight: Rectangle { color: "lightsteelblue"; radius: 5 }
                 focus: true


    [Qt Message] file:///C:/Private/2005be67/qml/ContactBook.qml:26: ReferenceError: Can't find variable: phoneNumber
    [Qt Message] file:///C:/Private/2005be67/qml/ContactBook.qml:25: ReferenceError: Can't find variable: name

  • I've used QtMobility.contacts only once and I don't remember well.

    See "this thread":http://developer.qt.nokia.com/forums/viewthread/11381 He uses @model: contactsmodel.contacts@

    I think that @contacts.name.firstName@ is also valid

  • Thanks, using contactsmodel.contacts as model solved the problem.

Log in to reply

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