Rectangle {
width: 100
height: 100
property int myValue: 0
onMyValueChanged: {
console.log("myValue changed from", PropertyChanges(myValue).from, "to", myValue)
}
MouseArea {
anchors.fill: parent
onClicked: myValue++
}
}
上面是一个获取已经改变的属性的值
- PropertyChanges().from 获取之前的value