diff options
author | Ian Walters <ian.walters@nokia.com> | 2009-05-06 01:22:40 (GMT) |
---|---|---|
committer | Ian Walters <ian.walters@nokia.com> | 2009-05-06 01:22:40 (GMT) |
commit | aca72d509b679b9bf1194e2575daad1245515b10 (patch) | |
tree | 5f8c8a78fecd6babd4d6ff45814385867fe61dd1 /examples | |
parent | 547223a4f31067ed34acabd9a2d8a0b7645fd3f8 (diff) | |
download | Qt-aca72d509b679b9bf1194e2575daad1245515b10.zip Qt-aca72d509b679b9bf1194e2575daad1245515b10.tar.gz Qt-aca72d509b679b9bf1194e2575daad1245515b10.tar.bz2 |
Use new syntax for properties and signals.
Diffstat (limited to 'examples')
11 files changed, 44 insertions, 117 deletions
diff --git a/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml index dc49d8e..99a521d 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml @@ -5,13 +5,8 @@ Rect { height: 30 color: "red" radius: 5 - properties: Property { - name: "expandedWidth" - value: 230 - } - signals: Signal { - name: "confirmed" - } + property var expandedWidth: 230 + signal confirmed //! [define properties and signals] resources: [ Script { diff --git a/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml b/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml index 4d95424..6ad2eb5 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml @@ -17,10 +17,6 @@ Rect { label: "Loading: qml property" } GroupBox { - contents: "1b/ContactField.qml" - label: "Loading: added path" - } - GroupBox { contents: "2/ContactField.qml" label: "Using properties" } @@ -29,12 +25,6 @@ Rect { contents: "3/ContactField.qml" label: "Defining signals" } - Rect { - color: "black" - opacity: 0.3 - width: prev.width - height: prev.height - } GroupBox { contents: "3/Contact.qml" label: "Multiple Items" diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml index 23560ce..763a771 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/Contact.qml @@ -3,22 +3,15 @@ Item { width: 230 height: layout.height - 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/2_Reuse/3/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml index 2d3d58a..890d781 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml @@ -4,17 +4,9 @@ Item { clip: true width: 230 height: 30 - properties: Property { - name: "label" - value: "Name" - } - properties: Property { - name: "icon" - value: "../../shared/pics/phone.png" - } - 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/2_Reuse/3/FieldText.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml index cf654cf..f6cc1e4 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml @@ -4,19 +4,11 @@ Rect { height: 30 radius: 5 color: "white" - properties: Property { - name: "text" - value: "" - onValueChanged: { reset() } - } + property var text: "" + onTextChanged: { reset() } //! [value change] - properties: Property { - name: "label" - value: "" - } - signals: Signal { - name: "confirmed" - } + property var label: "" + signal confirmed resources: [ Script { diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml index 8d82e89..2f27a69 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml @@ -5,13 +5,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() { diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml index 0587a51..bcb242f 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml @@ -3,27 +3,18 @@ Item { id: contactDetails width: 230 height: layout.height - properties: Property { - name: "mouseGrabbed" - value: false - } + property var mouseGrabbed: false //! [grab property] - 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/2_Reuse/4/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml index 0c422b7..e9927e9 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/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/2_Reuse/4/FieldText.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml index 6bb4e0a..e969f7b 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/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/2_Reuse/4/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml index b57a95b..bfe496e 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/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: [ //! [grab] Script { diff --git a/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml b/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml index 665c072..edaae72 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/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 |