Hi forum
I'm trying to use ComboBox inside Listview. I can't access to ComboBox model outside Listview
Window {
visible: true
//...
Button {
text: qsTr("Connect")
onClicked:{
apeWindowCmpst.visible = true
var code = "90"
var label = "doc"
console.log("code : "+code+" - label : "+label)
listAddApeCmpst.model.append({ "code":code ,
"libelle":label
});
modelAPECmpst.append({"name":code}) // can't acces to modelAPECmpst
}
}
Window {
id:apeWindowCmpst
...
ListView{
id:listAddApeCmpst
model: addApeModelCmpst
...
delegate:
Rectangle {
id :rectApeCmpst
...
Item{
id: itmCmpst
anchors.left: parent.left
anchors.leftMargin: 10
height: parent.height-100
width: parent.width-50
Grid{
id:gridAPEActCmpst
anchors.fill: parent
...
ListModel {
id: modelAPECmpst
}
ComboBox{
id:pApeListCmpst
editable: true
width: listAddApeCmpst.width/3*2-36
height: 33
textRole: "name"
model: modelAPECmpst
...
}
ListModel {
id: modelLabelAPECmpst
}
ComboBox{
id:pLabelApeListCmpst
editable: true
width: listAddApeCmpst.width/3*2-36
height: 40
textRole: "name"
model: modelLabelAPECmpst
...
}
}
}
}
}
ListModel {
id: addApeModelCmpst
}
}
}
Window {
visible: true
//...
Button {
text: qsTr("Connect")
onClicked:{
apeWindowCmpst.visible = true
var code = "90"
var label = "doc"
console.log("code : "+code+" - label : "+label)
listAddApeCmpst.model.append({ "code":code ,
"libelle":label
});
modelAPECmpst.append({"name":code}) // can't acces to modelAPECmpst
}
}
Window {
id:apeWindowCmpst
...
ListView{
id:listAddApeCmpst
model: addApeModelCmpst
...
delegate:
Rectangle {
id :rectApeCmpst
...
Item{
id: itmCmpst
anchors.left: parent.left
anchors.leftMargin: 10
height: parent.height-100
width: parent.width-50
Grid{
id:gridAPEActCmpst
anchors.fill: parent
...
ListModel {
id: modelAPECmpst
}
ComboBox{
id:pApeListCmpst
editable: true
width: listAddApeCmpst.width/3*2-36
height: 33
textRole: "name"
model: modelAPECmpst
...
}
ListModel {
id: modelLabelAPECmpst
}
ComboBox{
id:pLabelApeListCmpst
editable: true
width: listAddApeCmpst.width/3*2-36
height: 40
textRole: "name"
model: modelLabelAPECmpst
...
}
}
}
}
}
ListModel {
id: addApeModelCmpst
}
}
}
To copy to clipboard, switch view to plain text mode
>> delagate is a dynamic structure
I want to display values in ComboBox ??
Screenshot from 2016-10-21 12:11:58.png
Regards;
Bookmarks