Flesh out examples documentation
authorAlan Alpert <alan.alpert@nokia.com>
Fri, 20 Apr 2012 11:01:04 +0000 (21:01 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 26 Apr 2012 01:33:13 +0000 (03:33 +0200)
Change-Id: I4f7a1ce6b9957f43e442947dc6b319e919ec9cf7
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>

12 files changed:
examples/quick/accessibility/accessibility.qml
examples/quick/accessibility/content/Button.qml
examples/quick/animation/animation.qml
examples/quick/animation/basics/color-animation.qml
examples/quick/animation/basics/property-animation.qml
examples/quick/animation/behaviors/behavior-example.qml
examples/quick/animation/behaviors/tvtennis.qml
examples/quick/animation/behaviors/wigglytext.qml
examples/quick/animation/pathanimation/pathanimation.qml
examples/quick/animation/pathinterpolator/pathinterpolator.qml
examples/quick/animation/states/states.qml
examples/quick/animation/states/transitions.qml

index 5e4b0f8..b8e929e 100644 (file)
@@ -47,6 +47,13 @@ import "content"
     \example quick/accessibility
     \brief This example has accessible buttons.
 
+    Elements in this example are augmented with meta-data for accessiblity systems.
+
+    For example, the button identifies itself and its functionality to the accessibility system:
+    \snippet examples/quick/accessibility/content/Button.qml button
+
+    As do Text elements inside the example:
+    \snippet examples/quick/accessibility/accessibility.qml text
 */
 
 Rectangle {
@@ -74,8 +81,10 @@ Rectangle {
             height: column.h
             Text {
                 id: subjectLabel
+                //! [text]
                 Accessible.role: Accessible.StaticText
                 Accessible.name: text
+                //! [text]
                 text: "Subject:"
             }
             Rectangle {
index 3d5086f..f9eb5b4 100644 (file)
@@ -46,12 +46,14 @@ Rectangle {
 
     property bool checked: false
     property alias text : buttonText.text
+    //! [button]
     Accessible.name: text
     Accessible.description: "This button does " + text
     Accessible.role: Accessible.Button
     function accessiblePressAction() {
         button.clicked()
     }
+    //! [button]
 
     signal clicked
 
index f478cb7..a6735ef 100644 (file)
@@ -51,24 +51,39 @@ import "../../shared" as Examples
     a small QML file emphasizing a particular element or feature.
 
     ColorAnimation demonstrates using a color animation to fade a sky from day to night.
+    \snippet examples/quick/animation/basics/color-animation.qml 0
 
     PropertyAnimation demonstrates using a number animation to bounce a circle up and down.
+    \snippet examples/quick/animation/basics/property-animation.qml 0
 
     Behaviors demonstrates using behaviors to animate moving a rectangle to whereever you click.
+    \snippet examples/quick/animation/behaviors/behavior-example.qml 0
 
     Wiggly Text demonstrates using more complex behaviors to animate and wiggle some text around as you drag it.
+    It does this by assigning a complex binding to each letter:
+    \snippet examples/quick/animation/behaviors/wigglytext.qml 0
+    Then, it uses behaviors to animate the movement on each letter:
+    \snippet examples/quick/animation/behaviors/wigglytext.qml 1
 
     Tv Tennis demonstrates using more complex behaviors to get paddles following a ball for an infinite game.
+    Again a binding which depends on other values is applied to the position and a behavior provided the animation.
+    \snippet examples/quick/animation/behaviors/tvtennis.qml 0
 
     Easing Curves shows off all the easing curves available in Qt Quick animations.
 
     States demonstrates how the properties of an item can vary between states.
+    It defines several states:
+    \snippet examples/quick/animation/states/states.qml 0
+    Note that there is also the implicit 'base state' from properties set directly on elements.
 
-    Transitions takes the States example and animates the property changes.
+    Transitions takes the States example and animates the property changes by setting transitions:
+    \snippet examples/quick/animation/states/transitions.qml 0
 
     PathAnimation animates an image along a beizer curve using a PathAnimation.
+    \snippet examples/quick/animation/pathanimation/pathanimation.qml 0
 
     PathInterpolator animates an image along the same beizer curve, using a PathInterpolator instead.
+    \snippet examples/quick/animation/pathinterpolator/pathinterpolator.qml 0
 */
 
 Item {
index f1bf40c..85dca2d 100644 (file)
@@ -48,6 +48,7 @@ Item {
     // Let's draw the sky...
     Rectangle {
         anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }
+        //! [0]
         gradient: Gradient {
             GradientStop {
                 position: 0.0
@@ -66,6 +67,7 @@ Item {
                 }
             }
         }
+        //! [0]
     }
 
     // the sun, moon, and stars
index 4a4d3e3..2752b32 100644 (file)
@@ -81,6 +81,7 @@ Item {
         y: minHeight
         source: "images/face-smile.png"
 
+        //! [0]
         // Animate the y property. Setting loops to Animation.Infinite makes the
         // animation repeat indefinitely, otherwise it would only run once.
         SequentialAnimation on y {
@@ -101,5 +102,6 @@ Item {
             // Then pause for 500ms
             PauseAnimation { duration: 500 }
         }
+        //! [0]
     }
 }
index a88d7c8..e77c353 100644 (file)
@@ -92,10 +92,12 @@ Rectangle {
                 NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 }
             }
 
+            //! [0]
             // Set an 'elastic' behavior on the focusRect's y property.
             Behavior on y {
                 NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 }
             }
+            //! [0]
 
             Text {
                 id: focusText
index 108f19a..667b33f 100644 (file)
@@ -86,8 +86,10 @@ Rectangle {
         id: leftBat
         color: "Lime"
         x: 2; width: 20; height: 90
+        // ![0]
         y: ball.direction == 'left' ? ball.y - 45 : page.height/2 -45;
         Behavior on y { SpringAnimation{ velocity: 300 } }
+        // ![0]
     }
     Rectangle {
         id: rightBat
index 4bb94da..67e6da3 100644 (file)
@@ -86,8 +86,10 @@ Rectangle {
             id: letter
             property variant follow
 
+//! [0]
             x: follow ? follow.x + follow.width : container.width / 6
             y: follow ? follow.y : container.height / 2
+//! [0]
 
             font.pixelSize: 40; font.bold: true
             color: "#999999"; styleColor: "#222222"; style: Text.Raised
@@ -99,8 +101,10 @@ Rectangle {
                 onReleased: letter.color = "#999999"
             }
 
+//! [1]
             Behavior on x { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } }
             Behavior on y { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } }
+//! [1]
         }
     }
 
index f995218..06c0b86 100644 (file)
@@ -64,6 +64,7 @@ Rectangle {
         loops: -1
 
         PauseAnimation { duration: 1000 }
+        //! [0]
         PathAnimation {
             id: pathAnim
 
@@ -87,6 +88,7 @@ Rectangle {
                 onChanged: canvas.requestPaint()
             }
         }
+        //! [0]
     }
 
     Rectangle {
index 5a137c7..6813966 100644 (file)
@@ -59,6 +59,7 @@ Rectangle {
         }
     }
 
+    //! [0]
     PathInterpolator {
         id: motionPath
 
@@ -89,6 +90,7 @@ Rectangle {
             }
         }
     }
+    //! [0]
 
     Rectangle {
         id: box
index 7ca56a9..b92ba1b 100644 (file)
@@ -86,6 +86,7 @@ Rectangle {
     }
 
     states: [
+        // ![0]
         // In state 'middleRight', move the image to middleRightRect
         State {
             name: "middleRight"
@@ -97,5 +98,6 @@ Rectangle {
             name: "bottomLeft"
             PropertyChanges { target: userIcon; x: bottomLeftRect.x; y: bottomLeftRect.y  }
         }
+        // ![0]
     ]
 }
index d57924d..bfc4057 100644 (file)
@@ -105,6 +105,7 @@ Rectangle {
         }
     ]
 
+    // ![0]
     // Transitions define how the properties change when the item moves between each state
     transitions: [
 
@@ -126,5 +127,6 @@ Rectangle {
         Transition {
             NumberAnimation { properties: "x,y"; duration: 200 }
         }
+    // ![0]
     ]
 }