Thank you for the effort.
The problem is that this "otherObject" is not a QQuickItem, and I do not have a way to get it in QML. This "otherObject" is an item of the model itself.
So there is no point in initializing it in QML, like you did with
OtherObject{
id: obj2
}
http://doc.qt.io/qt-5/model-view-programming.html#creating-new-models
The ideal would be to get the pointer to the customQQuickItem instance in c++.
I'm thinking about setting a role and pass "this" in QML to that role.
That way I can access the instance in C++ side. But I'm not sure it would work... And I don't know how to access the current item in the model being built in QML side.
Update: I can access the QQuickItem now.
Though the method is not so covenient. Not something that I've seen, at least.
In my modelItem, I keep a *customQQuickItem pointer. Set to null in constructor.
Then, in QML:
customQQuickItem {
id:customItem
Component.onCompleted: {
customItemRole = customItem
}
}
Then, on the c++ side. The model handles the role, when QML sets it, and it updates the pointer.
And now, I have access to the custom QQuickItem