I did some tests with qxBlogModelView sample project :
is there a conflict name issue (role name == Q_INVOKABLE function name) with 1-1 and n-1 relationship
No : you can have role name == Q_INVOKABLE function name : QML engine is able to get the correct object/function (so no need to change QxEntityEditor).
The difference is :
-
to get the role value, you don't have to prefix by the model name instance ;
-
to call the Q_INVOKABLE function, you have to prefix by the model name instance.
For example, in my case, my root model is a blog model (named
myModel), and I have a n-1 (similar to 1-1) relationship to author, so I have a
author_id role and a
author_id() Q_INVOKABLE function. To get the author name, I can write :
- Code: Select all
Text { text: "author: " + myModel.author_id(0).getModelValue(0, "name") }
Using the author id role name (so no prefix by the model name instance), I write (which gives the row id in database of the author) :
- Code: Select all
Text { text: "author: " + author_id }
Another way to get the author name is to pass the author child model to another QML component, like this (in my case the other component is a ListView but you can use what you want) :
- Code: Select all
ListView {
model: myModel.author_id(0)
delegate: Row {
Text { text: "author: " + name }
}
}
So in your case, to get the address, you should write :
- Code: Select all
Text {
id: updateText
text: "Address 1 = " + customersModel.cmr_default_cad_id(0).getModelValue(0, "cad_address_1")
}
Or passing the address child model to another QML component, something like this :
- Code: Select all
ListView {
model: customersModel.cmr_default_cad_id(0)
delegate: Row {
Text { text: "address: " + cad_address_1 }
}
}
Could you try that please and let me know if it is working fine ?