Binding property to C++ function
-
Hi,
I've been working with qml plugin that have wrote myself. And I tried to bind some properties to some C++ function like that
@MyNewItem{
id:newItem
}Item{
property int test: newItem.somFuntion(someParam)
}
@The test property is binded to someParam. So if someParam change somFuntion will be recalled and test will be updated.
Now what if something change internally which will lead to change the result of somFuntion ? My test property never knows about it. To make this work i need to add
@onSomeSignal: newItem.somFuntion(someParam)@But thats lead to unhandy and disgracious code so I'm wandering if is there another way of linking the call of someFunction to a signal ?
-
Hi,
There isn't currently a way to link them, but there is a suggestion for this in the bug tracker: "QTBUG-17323":http://bugreports.qt.nokia.com/browse/QTBUG-17323 . I'd suggest leaving a comment there with your usecase if possible -- it would be helpful to see more examples of where this plays out in real life (e.g. the kind of internal changes that cause this sort of situation).
Thanks,
Michael