@Hamed.Masafi I see your point. However, the attempt below still fails.
The text in the Text element is shown correctly so there the title2() evaluates correctly (it also displays correctly when using a literal and/or when using no binding)
However, as the example below illustrates, when using the same objects through a model in ListView.delegate, I still get the same errors as reported initially.
Your second proposal indeed works (and is similar to the proposal of dheerendra above). However, this implies that the function gets evaluated for every item in the model while I would like to only evaluate the function for every visible item (=> when used in the delegate)
import QtQuick 2.3
import QtQuick.Window 2.2
Window {
visible: true
width: 600
height: 360
property var someObject : makeSomeObject("SomeTitle1")
function makeSomeObject(title){
var obj = {
title: title,
title2: Qt.binding (function() {return someObject.title})
};
return obj;
}
Text{
anchors.fill: parent
text: someObject.title2()
}
ListView {
anchors.fill: parent
model: ListModel {id: list_model}
delegate: Text {text: list_model.get(index).title2()}
}
Component.onCompleted: {
list_model.append(makeSomeObject("SomeTitle2"))
list_model.append(makeSomeObject("SomeTitle3"))
}
}