blob: e8f94451eba75739d27509333abe8d1389a81145 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
pragma ComponentBehavior: Bound
import QtQuick
Item {
id: root
property Component a: Item {
Timer {
interval: 1
running: root.choice < 4
function doit() {}
onTriggered: {
++root.choice
doit()
}
}
}
property Component b: Item {
Timer {
interval: 1
running: root.choice < 4
function doit() {}
onTriggered: {
++root.choice
doit()
}
}
}
property int choice: 0
Loader {
sourceComponent: switch (root.choice % 2) {
case 0: return root.a
case 1: return root.b
}
}
}
|