diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-20 08:33:57 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-20 08:33:57 (GMT) |
commit | c0a02f5c67d3de5e16fd506df83fef968e09c798 (patch) | |
tree | 53643122e75a4d549159a9ec6000aa5b6c4a1e03 /examples/declarative | |
parent | 86529642cfdc5cc5a94b735042d0807e3b57e9e1 (diff) | |
parent | 3182e16fa31a7def9775375971bea203af419d76 (diff) | |
download | Qt-c0a02f5c67d3de5e16fd506df83fef968e09c798.zip Qt-c0a02f5c67d3de5e16fd506df83fef968e09c798.tar.gz Qt-c0a02f5c67d3de5e16fd506df83fef968e09c798.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples/declarative')
-rw-r--r-- | examples/declarative/aspectratio/face_fit.qml | 4 | ||||
-rw-r--r-- | examples/declarative/aspectratio/face_fit_animated.qml | 4 | ||||
-rw-r--r-- | examples/declarative/aspectratio/scale_and_crop.qml | 4 | ||||
-rw-r--r-- | examples/declarative/aspectratio/scale_and_sidecrop.qml | 4 | ||||
-rw-r--r-- | examples/declarative/aspectratio/scale_to_fit.qml | 7 | ||||
-rw-r--r-- | examples/declarative/aspectratio/scale_to_fit_simple.qml | 17 | ||||
-rw-r--r-- | examples/declarative/follow/follow.qml | 17 | ||||
-rw-r--r-- | examples/declarative/minehunt/Explosion.qml | 15 | ||||
-rw-r--r-- | examples/declarative/minehunt/minehunt.qml | 7 | ||||
-rw-r--r-- | examples/declarative/snow/snow.qml | 9 |
10 files changed, 57 insertions, 31 deletions
diff --git a/examples/declarative/aspectratio/face_fit.qml b/examples/declarative/aspectratio/face_fit.qml index 35c63ce..3005d1b 100644 --- a/examples/declarative/aspectratio/face_fit.qml +++ b/examples/declarative/aspectratio/face_fit.qml @@ -1,7 +1,3 @@ -// The Image primitive does not have any special handling for maintaining -// aspect ratio. This example shows that you can provide whatever specific -// behaviour you like. -// // Here, we implement a hybrid of the "scale to fit" and "scale and crop" // behaviours which will crop up to 25% from *one* dimension if necessary // to fully scale the other. This is a realistic algorithm, for example diff --git a/examples/declarative/aspectratio/face_fit_animated.qml b/examples/declarative/aspectratio/face_fit_animated.qml index 366d27b..9036eeb 100644 --- a/examples/declarative/aspectratio/face_fit_animated.qml +++ b/examples/declarative/aspectratio/face_fit_animated.qml @@ -1,7 +1,3 @@ -// The Image primitive does not have any special handling for maintaining -// aspect ratio. This example shows that you can provide whatever specific -// behaviour you like. -// // Here, we extend the "face_fit" example with animation to show how truly // diverse and usage-specific behaviours are made possible by NOT putting a // hard-coded aspect ratio feature into the Image primitive. diff --git a/examples/declarative/aspectratio/scale_and_crop.qml b/examples/declarative/aspectratio/scale_and_crop.qml index a5409f9..2f35fb5 100644 --- a/examples/declarative/aspectratio/scale_and_crop.qml +++ b/examples/declarative/aspectratio/scale_and_crop.qml @@ -1,7 +1,3 @@ -// The Image primitive does not have any special handling for maintaining -// aspect ratio. This example shows that you can provide whatever specific -// behaviour you like. -// // Here, we implement "Scale and Crop" behaviour. // Rect { diff --git a/examples/declarative/aspectratio/scale_and_sidecrop.qml b/examples/declarative/aspectratio/scale_and_sidecrop.qml index e076735..4b1eb63 100644 --- a/examples/declarative/aspectratio/scale_and_sidecrop.qml +++ b/examples/declarative/aspectratio/scale_and_sidecrop.qml @@ -1,7 +1,3 @@ -// The Image primitive does not have any special handling for maintaining -// aspect ratio. This example shows that you can provide whatever specific -// behaviour you like. -// // Here, we implement a variant of "Scale and Crop" behaviour, where we // crop the sides if necessary to fully fit vertically, but not the reverse. // diff --git a/examples/declarative/aspectratio/scale_to_fit.qml b/examples/declarative/aspectratio/scale_to_fit.qml index 61a4082..867eb37 100644 --- a/examples/declarative/aspectratio/scale_to_fit.qml +++ b/examples/declarative/aspectratio/scale_to_fit.qml @@ -1,8 +1,5 @@ -// The Image primitive does not have any special handling for maintaining -// aspect ratio. This example shows that you can provide whatever specific -// behaviour you like. -// -// Here, we implement "Scale to Fit" behaviour. +// Here, we implement "Scale to Fit" behaviour "manually", rather +// than using the preserveAspect property. // Rect { // default size: whole image, unscaled diff --git a/examples/declarative/aspectratio/scale_to_fit_simple.qml b/examples/declarative/aspectratio/scale_to_fit_simple.qml new file mode 100644 index 0000000..4f89586 --- /dev/null +++ b/examples/declarative/aspectratio/scale_to_fit_simple.qml @@ -0,0 +1,17 @@ +// Here, we implement "Scale to Fit" behaviour, using the +// preserveAspect property. +// +Rect { + // default size: whole image, unscaled + width: Image.width + height: Image.height + color: "gray" + clip: true + + Image { + id: Image + source: "pics/face.png" + preserveAspect: true + anchors.fill: parent + } +} diff --git a/examples/declarative/follow/follow.qml b/examples/declarative/follow/follow.qml index 21a0309..37a953c 100644 --- a/examples/declarative/follow/follow.qml +++ b/examples/declarative/follow/follow.qml @@ -40,11 +40,24 @@ Rect { id: Mouse anchors.fill: parent Rect { + id: "Ball" width: 20; height: 20 radius: 10 color: "#0000ff" - x: Follow { source: Mouse.mouseX-10; spring: 1.0; damping: 0.05 } - y: Follow { source: Mouse.mouseY-10; spring: 1.0; damping: 0.05 } + x: Follow { id: "F1"; source: Mouse.mouseX-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } + y: Follow { id: "F2"; source: Mouse.mouseY-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } + states: [ + State { + name: "following" + when: !F1.inSync || !F2.inSync + SetProperties { target: Ball; color: "#ff0000" } + } + ] + transitions: [ + Transition { + ColorAnimation { duration: 200 } + } + ] } } } diff --git a/examples/declarative/minehunt/Explosion.qml b/examples/declarative/minehunt/Explosion.qml index 2886559..84e93d4 100644 --- a/examples/declarative/minehunt/Explosion.qml +++ b/examples/declarative/minehunt/Explosion.qml @@ -2,17 +2,26 @@ Item { property bool explode : false Particles { + id: particles width: 38 height: 21 - lifeSpan: 3600000 + lifeSpan: 1000 lifeSpanDeviation: 0 source: "pics/star.png" - count: 200 + count: 0 angle: 270 angleDeviation: 360 velocity: 100 velocityDeviation: 20 z: 100 - emitting: explode + opacity: 0 + streamIn: false } + states: [ State { name: "exploding"; when: explode == true + SetProperties { target: particles; count: 200 } + SetProperties { target: particles; opacity: 1 } + SetProperties { target: particles; emitting: false } // i.e. emit only once + } + ] + } diff --git a/examples/declarative/minehunt/minehunt.qml b/examples/declarative/minehunt/minehunt.qml index 286e485..3dc1da4 100644 --- a/examples/declarative/minehunt/minehunt.qml +++ b/examples/declarative/minehunt/minehunt.qml @@ -55,9 +55,10 @@ Item { opacity: modelData.hasMine } Explosion { + id: expl anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter - explode: modelData.hasMine && modelData.flipped + //explode: modelData.hasMine && modelData.flipped//Doesn't wait for the pause } } states: [ @@ -89,6 +90,10 @@ Item { easing: "easeInOutQuad" properties: "rotation" } + RunScriptAction{ + script: if(modelData.hasMine && modelData.flipped) + {expl.explode = true;} + } } } ] diff --git a/examples/declarative/snow/snow.qml b/examples/declarative/snow/snow.qml index 2b413bb..f65e0ac 100644 --- a/examples/declarative/snow/snow.qml +++ b/examples/declarative/snow/snow.qml @@ -27,11 +27,12 @@ Rect { property real targetDeform: 0 property bool slowDeform: true - property real deform - deform: Follow { source: MyLayout.targetDeform; velocity: MyLayout.slowDeform?0.1:2 } + property real deform: 0 + deform: Follow { + id: "DeformFollow"; source: MyLayout.targetDeform; velocity: MyLayout.slowDeform?0.1:2 + onSyncChanged: if(inSync) { MyLayout.slowDeform = true; MyLayout.targetDeform = 0; } + } - onDeformChanged: if(deform == targetDeform) { slowDeform = true; targetDeform = 0; } - ImageBatch { offset: 0; ref: ImagePanel } x: Follow { source: MyLayout.targetX; velocity: 1000 } |