summaryrefslogtreecommitdiffstats
path: root/examples/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-07-20 05:30:44 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-07-20 05:30:44 (GMT)
commit8ce0234b9aa4093c86179f038bdbd281b72a829a (patch)
tree7daed15acfcab0399ee58a59c2be3cd05572a8a9 /examples/declarative
parent2d0e618db203d47bfe5bda50e9cf258a19e9745c (diff)
parent2e4684e1004c3e5be16fb4ef21d8b2400063b241 (diff)
downloadQt-8ce0234b9aa4093c86179f038bdbd281b72a829a.zip
Qt-8ce0234b9aa4093c86179f038bdbd281b72a829a.tar.gz
Qt-8ce0234b9aa4093c86179f038bdbd281b72a829a.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.qml4
-rw-r--r--examples/declarative/aspectratio/face_fit_animated.qml4
-rw-r--r--examples/declarative/aspectratio/scale_and_crop.qml4
-rw-r--r--examples/declarative/aspectratio/scale_and_sidecrop.qml4
-rw-r--r--examples/declarative/aspectratio/scale_to_fit.qml7
-rw-r--r--examples/declarative/aspectratio/scale_to_fit_simple.qml17
-rw-r--r--examples/declarative/minehunt/Explosion.qml15
-rw-r--r--examples/declarative/minehunt/minehunt.qml7
8 files changed, 37 insertions, 25 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/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;}
+ }
}
}
]