blob: c948d47a1b4731fadfd98a3e60c5374a8c48520a (
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
|
import QtQml
import Test.PropertyCache
QtObject {
id: root
property BaseObject obj: null
property Connections connection: Connections {
target: obj
function onPropertyAChanged() { ++root.a }
}
onObjChanged: {
connection.target = obj // Make sure this takes effect before sending the signal
obj.propertyAChanged()
}
property BaseObject obj2: null
property Connections connection2: Connections {
target: obj2
function onSignalA() { ++root.b }
}
onObj2Changed: {
connection2.target = obj2 // Make sure this takes effect before sending the signal
obj2.signalA();
}
property BaseObject theObj: BaseObject {}
Component.onCompleted: {
// Make sure the change signals are triggered also initially
obj = theObj;
obj2 = theObj;
}
property int a: 0
property int b: 0
}
|