diff options
Diffstat (limited to 'demos/qmlcontacts/contents/ContactView.qml')
-rw-r--r-- | demos/qmlcontacts/contents/ContactView.qml | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/demos/qmlcontacts/contents/ContactView.qml b/demos/qmlcontacts/contents/ContactView.qml index 2472d8a1b1..ea1255ac89 100644 --- a/demos/qmlcontacts/contents/ContactView.qml +++ b/demos/qmlcontacts/contents/ContactView.qml @@ -48,6 +48,12 @@ Item { signal deleted(int id) property bool showDetailed: false + // list<string> type properties do not update automatically as model, assigning them again triggers an update + function update() { + phoneNumberRepeater.model = contact.phoneNumbers + emailRepeater.model = contact.emails + } + ListView { id: normalView focus: true @@ -56,6 +62,8 @@ Item { anchors.top: parent.top anchors.bottom: toolBar.top opacity: 1 + clip: true + spacing: 2 transform: Scale { id: normalViewScale; xScale: 1 @@ -101,7 +109,9 @@ Item { font.weight: Font.Bold } Column { + spacing: 2 Repeater { + id: phoneNumberRepeater model: contact ? contact.phoneNumbers : [] delegate: FieldRow { @@ -121,6 +131,7 @@ Item { "import QtMobility.contacts 1.1;" + "PhoneNumber {number: ''}", contact); contact.addDetail(detail); + update(); } } @@ -134,7 +145,9 @@ Item { font.weight: Font.Bold } Column { + spacing: 2 Repeater { + id: emailRepeater model: contact ? contact.emails : [] delegate: FieldRow { @@ -154,6 +167,7 @@ Item { "import QtMobility.contacts 1.1;" + "EmailAddress {emailAddress: ''}", contact); contact.addDetail(detail); + update(); } } } @@ -167,6 +181,7 @@ Item { anchors.top: parent.top anchors.bottom: toolBar.top opacity: 1 + clip: true transform: Scale { id: detailViewScale; xScale: 0 @@ -198,12 +213,13 @@ Item { height: childrenRect.height Text { id: fieldName - width: parent.width * 0.5; + width: parent.width * 0.4; height: 20; anchors.margins: 3 anchors.left: parent.left text: modelData color: "white" + elide: Text.ElideRight } Text { id: textRect @@ -235,9 +251,14 @@ Item { switch (index) { case 0: contact.save(); + showDetailed = false; + break; + case 1: + showDetailed = false; break; case 2: deleted(contact.contactId) + showDetailed = false; break; case 3: showDetailed = !showDetailed; |