From 36a2adb9970971e2ff82bc4636cafc77211ecb9b Mon Sep 17 00:00:00 2001 From: Ian Walters Date: Wed, 6 May 2009 11:50:41 +1000 Subject: Use new syntax for properties and signals. --- .../contacts/3_Collections/1/ContactView.qml | 5 +---- .../contacts/3_Collections/2/ContactView.qml | 13 +++++------ .../contacts/3_Collections/3/ContactView.qml | 15 +++++-------- .../tutorials/contacts/3_Collections/GroupBox.qml | 10 ++++----- .../contacts/3_Collections/lib/Button.qml | 8 ++----- .../contacts/3_Collections/lib/Contact.qml | 26 +++++++++------------- .../contacts/3_Collections/lib/ContactField.qml | 12 +++------- .../contacts/3_Collections/lib/FieldText.qml | 16 ++++--------- .../contacts/3_Collections/lib/RemoveButton.qml | 9 ++------ 9 files changed, 37 insertions(+), 77 deletions(-) diff --git a/examples/declarative/tutorials/contacts/3_Collections/1/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/1/ContactView.qml index ce338e2..5400544 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/1/ContactView.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/1/ContactView.qml @@ -3,10 +3,7 @@ Item { id: contacts width: 240 height: 230 - properties: Property { - name: "mouseGrabbed" - value: false - } + property var mouseGrabbed: false resources: [ //! [model] SqlConnection { diff --git a/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml index b6b3c31..0a293f5 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml @@ -3,10 +3,7 @@ Item { id: contacts width: 240 height: 230 - properties: Property { - name: "mouseGrabbed" - value: false - } + property var mouseGrabbed: false resources: [ SqlConnection { id: contactDatabase @@ -58,12 +55,12 @@ Item { } MouseRegion { anchors.fill: label - onClicked: { wrapper.state='opened' } + onClicked: { wrapper.state='opened'; } } Contact { - id: details + id: Details anchors.fill: parent - contactid: model.recid + contactId: model.recid label: model.label email: model.email phone: model.phone @@ -95,7 +92,7 @@ Item { value: 0 } SetProperty { - target: details + target: Details property: "opacity" value: 1 } diff --git a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml index f0b55db..7a44a3f 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml @@ -3,10 +3,7 @@ Item { id: contacts width: 240 height: 230 - properties: Property { - name: "mouseGrabbed" - value: false - } + property var mouseGrabbed: false resources: [ SqlConnection { id: contactDatabase @@ -17,7 +14,7 @@ Item { SqlQuery { id: contactList connection: contactDatabase - query: "SELECT recid AS contactid, label, email, phone FROM contacts ORDER BY label, recid" + query: "SELECT recid, label, email, phone FROM contacts ORDER BY label, recid" } ] Button { @@ -49,9 +46,9 @@ Item { x: 45 y: 12 width: parent.width-45 - text: model.label color: "black" font.bold: true + text: model.label } //! [setting qml] MouseRegion { @@ -63,14 +60,14 @@ Item { } Item { id: Details - anchors.fill: wrapper + anchors.fill: parent opacity: 0 //! [setting qml] //! [binding] Bind { target: Details.qmlItem - property: "contactid" - value: model.contactid + property: "contactId" + value: model.recid } Bind { target: Details.qmlItem diff --git a/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml b/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml index 665c072..edaae72 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml @@ -2,12 +2,10 @@ FocusRealm { id: groupBox width: Math.max(270, subItem.width+40) height: Math.max(70, subItem.height+40) - properties: Property { - name: "contents" - } - properties: Property { - name: "label" - } + + property var contents + property var label + Rect { id: wrapper x: 5 diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml index 57267f8..d9f1236 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/Button.qml @@ -2,12 +2,8 @@ Item { id: button width: 30 height: 30 - properties: Property { - name: "icon" - } - signals: Signal { - name: "clicked" - } + property var icon: "" + signal clicked Rect { id: buttonRect anchors.fill: parent diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/Contact.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/Contact.qml index a7e78dc..6832076 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/Contact.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/Contact.qml @@ -1,22 +1,16 @@ Item { id: contactDetails anchors.fill: parent - properties: Property { - name: "contactid" - value: "" - } - properties: Property { - name: "label" - onValueChanged: { labelField.value = label } - } - properties: Property { - name: "phone" - onValueChanged: { phoneField.value = phone } - } - properties: Property { - name: "email" - onValueChanged: { emailField.value = email } - } + + property var contactId: "" + property var label: "" + property var phone: "" + property var email: "" + + onLabelChanged: { labelField.value = label } + onEmailChanged: { emailField.value = email } + onPhoneChanged: { phoneField.value = phone } + VerticalLayout { id: layout anchors.fill: parent diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml index 0c422b7..e9927e9 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml @@ -2,15 +2,9 @@ Item { id: contactField clip: true height: 30 - properties: Property { - name: "label" - } - properties: Property { - name: "icon" - } - properties: Property { - name: "value" - } + property var label: "Name" + property var icon: "../../shared/pics/phone.png" + property var value: "" RemoveButton { id: removeButton anchors.right: parent.right diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml index 8ba01da..427e2b0 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml @@ -3,18 +3,10 @@ Rect { height: 30 radius: 5 color: "white" - properties: Property { - name: "text" - value: "" - onValueChanged: { reset() } - } - properties: Property { - name: "label" - value: "" - } - signals: Signal { - name: "confirmed" - } + property var text: "" + property var label: "" + onTextChanged: { reset() } + signal confirmed resources: [ Script { diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml index 0b90e48..c0ea79d 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml @@ -4,13 +4,8 @@ Rect { height: 30 color: "red" radius: 5 - properties: Property { - name: "expandedWidth" - value: 230 - } - signals: Signal { - name: "confirmed" - } + property var expandedWidth: 230 + signal confirmed resources: [ Script { function toggle() { -- cgit v0.12