Hi All

I have come across some strangeness using QtContacts 5.0 on Sailfish.

For various reasons partially lost in the mists of time, I copy contacts (or rather a subset of contract roles) from the ContactModel to a a normal ListModel.

One of the roles copied is "phoneNumbers". This has a child property "length" indicating the number of phoneNumbers available for the contact.

phoneNumbers.length is available (defined) direct from the ContactModel, but is undefined when I try to use it from the ListModel. So the console.log in the function appendContact() gives a valid result, but the console.log in populate() gives undefined.

Other properties, including the phone numbers in phoneNumbers are defined when accessed from the ListModel.

Equivalent code works in Haramtatan / Qt 4.7.4 Mobility 1.2


        import QtContacts 5.0

        ContactModel {
        id: phoneContactsModelInternal
        }

        ListModel {
        id: localContactModelInternal
        function populate() {
            clear();
for (var i = 0; i < phoneContactsModelInternal.contacts.length; i ++) {
                appendContact(phoneContactsModelInternal.contacts[i]);
console.log("checking number of phoneNumbers: " + localContactModel.get(i).phoneNumbers.length);
            }
        }
        function appendContact(contact) {
            localContactModel.append({"contactId": contact.contactId,
                                  "displayLabel": contact.displayLabel.label,
                                  "phoneNumbers": contact.phoneNumbers,
"phoneNumbersCount": contact.phoneNumbers.length}); console.log("appending: " + contact.displayLabel.label + ", numbers: " + contact.phoneNumbers.length)
        }
    }

Any ideas?

Chris

_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to