Reputation: 1190
MyObject
Item {
property int current: 0
}
Can this be configured to emit a signal such that the following works?
Item {
property variant myObj: MyObject {}
onMyObjChanged: doThis()
...
}
Upvotes: 0
Views: 2007
Reputation: 24396
cmannet85 has answered your question: it's not possible. Perhaps you could post more code so we can suggest alternative approaches.
In terms of a solution using the information you've provided, you should expose signals that client code should connect to in order to know when the object has changed. Since you said the current
property is all that matters, and it already has a change signal, you can use Connections
:
Connections {
target: myObj
onCurrentChanged: doThis()
}
Or connect to the signal manually:
Component.onCompleted: {
myObj.onCurrentChanged.connect(doThis);
}
function doThis() {
// ...
}
Upvotes: 2