Initial import from qtquick2.
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qmlvisual / qdeclarativepositioners / dynamic.qml
1 import QtQuick 1.0
2
3 Item {
4     width: 120; height: 60;
5     property int step: 0
6     property int tickTime: 250;
7     function tick()
8     {
9         step++;
10         if(step == 1){
11             //row1.destroy(); //Not dynamically created, so is this valid?
12         }else if(step == 2){
13             r2a.destroy();
14         }else if(step == 3){
15             r2b.destroy();
16         }else if(step == 4){
17             r2c.destroy();
18         }else if(step == 5){
19             r3a.parent = row2;
20         }else if(step == 6){
21             r3b.parent = row2;
22         }else if(step == 7){
23             r3c.parent = row2;
24         }else if(step == 8){
25             //row3.destroy();//empty now, so should have no effect//May be invalid, but was deleting the reparent items at one point
26         }else{
27             repeater.model++;
28         }
29     }
30
31     //Tests base positioner functionality, so don't need them all.
32     Column{
33         move: Transition{NumberAnimation{properties:"y"; duration: tickTime}}
34         Row{
35             id: row1
36             height: childrenRect.height
37             Rectangle{id: r1a; width:20; height:20; color: "red"}
38             Rectangle{id: r1b; width:20; height:20; color: "green"}
39             Rectangle{id: r1c; width:20; height:20; color: "blue"}
40         }
41         Row{
42             id: row2
43             height: childrenRect.height
44             move: Transition{NumberAnimation{properties:"x"; duration: tickTime}}
45             add: Transition{NumberAnimation{properties:"x"; duration: tickTime}}
46             Repeater{ 
47                 id: repeater 
48                 model: 0; 
49                 delegate: Component{ Rectangle { color: "yellow"; x:20; width:20; height:20;}}
50             }
51             Rectangle{id: r2a; width:20; height:20; color: "red"}
52             Rectangle{id: r2b; width:20; height:20; color: "green"}
53             Rectangle{id: r2c; width:20; height:20; color: "blue"}
54         }
55         Row{
56             move: Transition{NumberAnimation{properties:"x"; duration: tickTime}}
57             id: row3
58             height: childrenRect.height
59             Rectangle{id: r3a; width:20; height:20; color: "red"}
60             Rectangle{id: r3b; width:20; height:20; color: "green"}
61             Rectangle{id: r3c; width:20; height:20; color: "blue"}
62         }
63     }
64     Timer{
65         interval: tickTime;
66         running: true;
67         repeat: true;
68         onTriggered: tick();
69     }
70 }
71