summaryrefslogtreecommitdiffstats
path: root/examples/declarative/dynamic
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-10-15 08:28:03 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-10-15 08:50:07 (GMT)
commit2eb67032ea81aa105a854644f337ad5377c2994e (patch)
tree607ec93728281836a3a5661397495b014229dcfd /examples/declarative/dynamic
parent2967e68f9a3bae4f5a2865ac901b08d8b6f0f0f1 (diff)
downloadQt-2eb67032ea81aa105a854644f337ad5377c2994e.zip
Qt-2eb67032ea81aa105a854644f337ad5377c2994e.tar.gz
Qt-2eb67032ea81aa105a854644f337ad5377c2994e.tar.bz2
Fix dynamic example
Had some accidental global vars Task-number: One of the QT-2270s
Diffstat (limited to 'examples/declarative/dynamic')
-rw-r--r--examples/declarative/dynamic/dynamic.qml8
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/declarative/dynamic/dynamic.qml b/examples/declarative/dynamic/dynamic.qml
index 66fdf87..2c6a8e0 100644
--- a/examples/declarative/dynamic/dynamic.qml
+++ b/examples/declarative/dynamic/dynamic.qml
@@ -8,6 +8,7 @@ Rectangle {
Script { source: "dynamic.js" }
property bool extendStars: false
+ property var fourthBox: undefined
Item { id: targetItem; x: 100; y: 100; }
Item { id: targetItem2; x: 0; y: 300; }
@@ -20,7 +21,7 @@ Rectangle {
MouseRegion {
anchors.fill: parent
- onClicked: { a = createWithComponent(); }
+ onClicked: { var a = createWithComponent(); }
}
}
@@ -47,8 +48,8 @@ Rectangle {
MouseRegion {
anchors.fill: parent
onClicked: {
- if (fourthBox == null) {
- a = createQml(targetItem2);
+ if (fourthBox == null || fourthBox == undefined) {
+ var a = createQml(targetItem2);
if (a != null) {
a.parent = targetItem2;//BUG: this should happen automatically
fourthBox = a;
@@ -68,6 +69,7 @@ Rectangle {
Particles {
x: 0
y: 0
+ z: 10
count: 20
lifeSpan: 500
width: 100