There is kind of a limitation in QML in this regard.
Since your property is itself an object rather than a primitive, its changed signal will emit only when the property is changed to be assigned to another object, it WILL NOT reflect internal changes to this object. Also, you cannot manually emit the signal either, it will only automatically emit when the property is changed.
myComponent.myProperty = 1.1 // this will not trigger onMyComponentChanged
myComponent = anotherObject // this will trigger onMyComponentChanged
Since your component has only a single property and it already has a change notification, you can use that:
property var myComponent : myComp // you can omit that if you don't need it as a property
MyComponent {
id: myComp
myProperty: 13.37
onMyPropertyChanged: console.log("changed")
}
or...
property var myComponent : MyComponent {
myProperty: 13.37
}
Connections {
target: myComponent
onMyPropertyChanged: console.log("changed")
}
If your component has multiple properties, you should implement a signal changed() in it and emit it on every property changed and use that signal to reflect internal changes instead of the one automatically generated by the QML property, which will not reflect them:
QtObject {
property real myProperty
property bool otherProperty
onMyPropertyChanged: changed()
onOtherPropertyChanged: changed()
signal changed()
}
...
property var myComponent : MyComponent {
myProperty: 13.37
}
Connections {
target: myComponent
onChanged: console.log("changed")
}