Hi,
I want to set default value for combobox. But "find" method returns -1.
MyComboBox{
id:cmbZoom
model:XmlListModel {
id: xmlZoomModel
source: "files/zoom.XML"
query: "/tbl_zoomCalib/record"
XmlRole { name: "text"; query: "@zoom/string()" }
XmlRole { name: "value"; query: "@number/string()" }
}
textRole: "text"
onCurrentIndexChanged: {
myXML.newZoom=xmlZoomModel.get(currentIndex).text;
}
Component.onCompleted: {
currentIndex=cmbZoom.find("20");
}
}
MyComboBox{
id:cmbZoom
model:XmlListModel {
id: xmlZoomModel
source: "files/zoom.XML"
query: "/tbl_zoomCalib/record"
XmlRole { name: "text"; query: "@zoom/string()" }
XmlRole { name: "value"; query: "@number/string()" }
}
textRole: "text"
onCurrentIndexChanged: {
myXML.newZoom=xmlZoomModel.get(currentIndex).text;
}
Component.onCompleted: {
currentIndex=cmbZoom.find("20");
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks