diff options
author | Ian Walters <ian.walters@nokia.com> | 2009-04-29 23:18:09 (GMT) |
---|---|---|
committer | Ian Walters <ian.walters@nokia.com> | 2009-04-29 23:18:09 (GMT) |
commit | 7a60538c0c12245e8b542a477bcaabac0b9de345 (patch) | |
tree | c216fd1d55ba703dfbcfcec591d5c476f170aea2 /examples/declarative/tutorials | |
parent | 57a5fbad609b0b0d844d7d4ed16558bfbaf725fe (diff) | |
download | Qt-7a60538c0c12245e8b542a477bcaabac0b9de345.zip Qt-7a60538c0c12245e8b542a477bcaabac0b9de345.tar.gz Qt-7a60538c0c12245e8b542a477bcaabac0b9de345.tar.bz2 |
documentation snippets, some qmlconv cleanup
Added snippet comments for qdoc, also qmlconv leaves some
errors. ',' where they are not supposed to be,
] and indenting in the wrong places, lack of " around
enum values.
Diffstat (limited to 'examples/declarative/tutorials')
22 files changed, 127 insertions, 110 deletions
diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml index 632ade9..ec768da 100644 --- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml @@ -7,9 +7,7 @@ Rect { //! [script] resources: [ Script { - function toggle() { - print('removeButton.toggle()'); if (removeButton.state == 'opened') { removeButton.state = ''; } else { diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml index a56193d..b2fa0ca 100644 --- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml @@ -6,9 +6,7 @@ Rect { radius: 5 resources: [ Script { - function toggle() { - print('removeButton.toggle()'); if (removeButton.state == 'opened') { removeButton.state = ''; } else { diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/1/ContactField.qml index 1c50110..078f62e 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/1/ContactField.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/1/ContactField.qml @@ -1,3 +1,4 @@ +//! [load] Item { id: contactField clip: true @@ -9,6 +10,7 @@ Item { anchors.top: parent.top anchors.bottom: parent.bottom } +//! [load] Text { id: fieldText width: contactField.width-80 diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml index b3ac12d..12329ed 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml @@ -6,9 +6,7 @@ Rect { radius: 5 resources: [ Script { - function toggle() { - print('removeButton.toggle()'); if (removeButton.state == 'opened') { removeButton.state = ''; } else { @@ -69,7 +67,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: AlignHCenter + hAlign: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml index 07ab55c..55229de 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/1a/ContactField.qml @@ -1,3 +1,4 @@ +//! [load] Item { id: contactField clip: true @@ -12,6 +13,7 @@ Item { anchors.top: parent.top anchors.bottom: parent.bottom } +//! [load] Text { id: fieldText width: contactField.width-80 diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml index b3ac12d..12329ed 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml @@ -6,9 +6,7 @@ Rect { radius: 5 resources: [ Script { - function toggle() { - print('removeButton.toggle()'); if (removeButton.state == 'opened') { removeButton.state = ''; } else { @@ -69,7 +67,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: AlignHCenter + hAlign: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/2_Reuse/2/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/2/ContactField.qml index badf7a4..df4b46f 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/2/ContactField.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/2/ContactField.qml @@ -3,14 +3,16 @@ Item { clip: true width: 230 height: 30 +//! [use properties and signals] RemoveButton { id: removeButton anchors.right: parent.right anchors.top: parent.top anchors.bottom: parent.bottom expandedWidth: contactField.width - onConfirmed: { print('Clear field text'); fieldText.text='' } + onConfirmed: { fieldText.text='' } } +//! [use properties and signals] Text { id: fieldText width: contactField.width-80 diff --git a/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml index e6c7c82..642a33b 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml @@ -1,3 +1,4 @@ +//! [define properties and signals] Rect { id: removeButton width: 30 @@ -11,11 +12,10 @@ Rect { signals: Signal { name: "confirmed" } +//! [define properties and signals] resources: [ Script { - function toggle() { - print('removeButton.toggle()'); if (removeButton.state == 'opened') { removeButton.state = ''; } else { @@ -76,7 +76,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: AlignHCenter + hAlign: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml b/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml index 540e900..4d95424 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml @@ -21,17 +21,20 @@ Rect { label: "Loading: added path" } GroupBox { - contents: "1c/ContactField.qml" - label: "Loading: added namespace" - } - GroupBox { contents: "2/ContactField.qml" label: "Using properties" } GroupBox { + id: prev 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/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml index 26bfca5..fa4f997 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/ContactField.qml @@ -1,3 +1,4 @@ +//! [all] Item { id: contactField clip: true @@ -20,7 +21,7 @@ Item { anchors.top: parent.top anchors.bottom: parent.bottom expandedWidth: contactField.width - onConfirmed: { print('Clear field text'); fieldText.text='' } + onConfirmed: { fieldText.text='' } } FieldText { id: fieldText @@ -65,3 +66,4 @@ Item { } ] } +//! [all] diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml index 7da13e7..7e4a1ce 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml @@ -1,3 +1,4 @@ +//! [value change] Rect { id: fieldText height: 30 @@ -8,6 +9,7 @@ Rect { value: "" onValueChanged: { reset() } } +//! [value change] properties: Property { name: "label" value: "" @@ -65,12 +67,13 @@ Rect { readOnly: true wrap: false } +//! [behavior] Text { id: textLabel x: 5 width: parent.width-10 anchors.verticalCenter: parent.verticalCenter - hAlign: AlignHCenter + hAlign: "AlignHCenter" color: "#505050" font.italic: true text: fieldText.label @@ -82,6 +85,7 @@ Rect { } } } +//! [behavior] MouseRegion { anchors.fill: cancelIcon onClicked: { reset() } diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml index e6c7c82..a222734 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml @@ -13,9 +13,7 @@ Rect { } resources: [ Script { - function toggle() { - print('removeButton.toggle()'); if (removeButton.state == 'opened') { removeButton.state = ''; } else { @@ -76,7 +74,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: AlignHCenter + hAlign: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml index 626f99d..0587a51 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/Contact.qml @@ -1,3 +1,4 @@ +//! [grab property] Item { id: contactDetails width: 230 @@ -6,6 +7,7 @@ Item { name: "mouseGrabbed" value: false } +//! [grab property] properties: Property { name: "contactid" value: "" diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml index acc40e2..61de59d 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/ContactField.qml @@ -17,7 +17,7 @@ Item { anchors.top: parent.top anchors.bottom: parent.bottom expandedWidth: contactField.width - onConfirmed: { print('Clear field text'); fieldText.text='' } + onConfirmed: { fieldText.text='' } } FieldText { id: fieldText diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml index 3d92827..da5e6b9 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml @@ -75,7 +75,7 @@ Rect { x: 5 width: parent.width-10 anchors.verticalCenter: parent.verticalCenter - hAlign: AlignHCenter + hAlign: "AlignHCenter" color: "#505050" font.italic: true text: fieldText.label diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml index 1e3b5ad..bc30ee6 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml @@ -12,10 +12,9 @@ Rect { name: "confirmed" } resources: [ +//! [grab] Script { - function toggle() { - print('removeButton.toggle()'); if (removeButton.state == 'opened') { removeButton.state = ''; contactDetails.mouseGrabbed=false; @@ -28,6 +27,7 @@ Rect { } } +//! [grab] ] Image { id: trashIcon @@ -80,7 +80,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: AlignHCenter + hAlign: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/3_Collections/1/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/1/ContactView.qml index 8c02b48..ce338e2 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/1/ContactView.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/1/ContactView.qml @@ -8,6 +8,7 @@ Item { value: false } resources: [ +//! [model] SqlConnection { id: contactDatabase name: "qmlConnection" @@ -18,9 +19,18 @@ Item { id: contactList connection: contactDatabase query: "SELECT recid, label, email, phone FROM contacts ORDER BY label, recid" - }, - Component { - id: contactDelegate + } +//! [model] + ] +//! [view] + ListView { + id: contactListView + anchors.fill: parent + clip: true + model: contactList + focus: true +//! [delegate] + delegate: [ Text { x: 45 y: 12 @@ -30,14 +40,8 @@ Item { font.bold: true text: model.label } - } - ] - ListView { - id: contactListView - anchors.fill: parent - clip: true - model: contactList - delegate: contactDelegate - focus: true + ] +//! [delegate] } +//! [view] } diff --git a/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml index 88fc121..b6b3c31 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/2/ContactView.qml @@ -17,10 +17,31 @@ Item { SqlQuery { id: contactList connection: contactDatabase - query: "SELECT recid AS contactid, label, email, phone FROM contacts ORDER BY label, recid" - }, - Component { - id: contactDelegate + query: "SELECT recid, label, email, phone FROM contacts ORDER BY label, recid" + } + ] +//! [button] + Button { + id: cancelEditButton + anchors.top: parent.top + anchors.topMargin: 5 + anchors.right: parent.right + anchors.rightMargin: 5 + icon: "../../shared/pics/cancel.png" + opacity: mouseGrabbed ? 0 : 1 + } +//! [button] + ListView { + id: contactListView + anchors.left: parent.left + anchors.right: parent.right + anchors.top: cancelEditButton.bottom + anchors.bottom: parent.bottom + clip: true + model: contactList + focus: true + delegate: [ +//! [components] Item { id: wrapper x: 0 @@ -31,9 +52,9 @@ Item { x: 45 y: 12 width: parent.width-45 - text: model.label color: "black" font.bold: true + text: model.label } MouseRegion { anchors.fill: label @@ -42,12 +63,14 @@ Item { Contact { id: details anchors.fill: parent - contactid: model.contactid + contactid: model.recid label: model.label email: model.email phone: model.phone opacity: 0 } +//! [components] +//! [states] states: [ State { name: "opened" @@ -78,6 +101,8 @@ Item { } } ] +//! [states] +//! [transitions] transitions: [ Transition { NumericAnimation { @@ -86,38 +111,19 @@ Item { } } ] +//! [transitions] +//! [connections] Connection { sender: cancelEditButton signal: "clicked()" script: { - - if (wrapper.state == 'opened') { - wrapper.state = ''; - } - + if (wrapper.state == 'opened') { + wrapper.state = ''; + } } } +//! [connections] } - }, - Button { - id: cancelEditButton - anchors.top: parent.top - anchors.topMargin: 5 - anchors.right: parent.right - anchors.rightMargin: 5 - icon: "../../shared/pics/cancel.png" - opacity: mouseGrabbed ? 0 : 1 - }, - ListView { - id: contactListView - anchors.left: parent.left - anchors.right: parent.right - anchors.top: cancelEditButton.bottom - anchors.bottom: parent.bottom - clip: true - model: contactList - delegate: contactDelegate - focus: true - } - ] + ] + } } diff --git a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml index 09aab71..f0b55db 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/3/ContactView.qml @@ -18,9 +18,27 @@ Item { id: contactList connection: contactDatabase query: "SELECT recid AS contactid, label, email, phone FROM contacts ORDER BY label, recid" - }, - Component { - id: contactDelegate + } + ] + Button { + id: cancelEditButton + anchors.top: parent.top + anchors.topMargin: 5 + anchors.right: parent.right + anchors.rightMargin: 5 + icon: "../../shared/pics/cancel.png" + opacity: mouseGrabbed ? 0 : 1 + } + ListView { + id: contactListView + anchors.left: parent.left + anchors.right: parent.right + anchors.top: cancelEditButton.bottom + anchors.bottom: parent.bottom + clip: true + model: contactList + focus: true + delegate: [ Item { id: wrapper x: 0 @@ -35,15 +53,20 @@ Item { color: "black" font.bold: true } +//! [setting qml] MouseRegion { anchors.fill: label - onClicked: { Details.qml = 'Contact.qml'; - wrapper.state='opened'; } + onClicked: { + Details.qml = 'Contact.qml'; + wrapper.state='opened'; + } } Item { id: Details anchors.fill: wrapper opacity: 0 +//! [setting qml] +//! [binding] Bind { target: Details.qmlItem property: "contactid" @@ -64,6 +87,7 @@ Item { property: "email" value: model.email } +//! [binding] } states: [ State { @@ -107,34 +131,12 @@ Item { sender: cancelEditButton signal: "clicked()" script: { - - if (wrapper.state == 'opened') { - wrapper.state = ''; - } - + if (wrapper.state == 'opened') { + wrapper.state = ''; + } } } } - }, - Button { - id: cancelEditButton - anchors.top: parent.top - anchors.topMargin: 5 - anchors.right: parent.right - anchors.rightMargin: 5 - icon: "../../shared/pics/cancel.png" - opacity: mouseGrabbed ? 0 : 1 - }, - ListView { - id: contactListView - anchors.left: parent.left - anchors.right: parent.right - anchors.top: cancelEditButton.bottom - anchors.bottom: parent.bottom - clip: true - model: contactList - delegate: contactDelegate - focus: true - } - ] + ] + } } diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml index acc40e2..61de59d 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/ContactField.qml @@ -17,7 +17,7 @@ Item { anchors.top: parent.top anchors.bottom: parent.bottom expandedWidth: contactField.width - onConfirmed: { print('Clear field text'); fieldText.text='' } + onConfirmed: { fieldText.text='' } } FieldText { id: fieldText diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml index 1329db6..370ca00 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml @@ -75,7 +75,7 @@ Rect { x: 5 width: parent.width-10 anchors.verticalCenter: parent.verticalCenter - hAlign: AlignHCenter + hAlign: "AlignHCenter" color: "#505050" font.italic: true text: fieldText.label diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml index d99b550..7e0a2f9 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml @@ -13,9 +13,7 @@ Rect { } resources: [ Script { - function toggle() { - print('removeButton.toggle()'); if (removeButton.state == 'opened') { removeButton.state = ''; contacts.mouseGrabbed=false; @@ -80,7 +78,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: AlignHCenter + hAlign: "AlignHCenter" text: "Remove" opacity: 0 } |