03-18-2013 02:05 PM
Hi,
Consider, having following xml file
<model>
<header title="A">
<city title="Algiers">
<lonlat value="36.76,3.05" />
</city>
</header>
</model>How can I retrieve the value from the lonlat key "36.76,3.05"
in my qml file I got something like
...
Page {
id: ch_loc
Container {
//background: Color.White
ListView {
dataModel: XmlDataModel {
source: "LonLat.xml"
}
listItemComponents: [
ListItemComponent {
}
]
onTriggered: {
//qDebug(indexPath[3]);
app.initiateRequest(dataModel.data(indexPath[0]))
}
}
}
}
...Am I on the right way? Need help please.
Thank you, regards.
Maddin
Solved! Go to Solution.
03-18-2013 03:51 PM
03-18-2013 04:01 PM
Hi,
Ok after some reading, I figured it out.
What I did:
Page {
id: ch_loc
Container {
//background: Color.White
ListView {
dataModel: XmlDataModel {
source: "LonLat.xml"
}
listItemComponents: [
ListItemComponent {
}
]
onTriggered: {
var selectedItem = dataModel.data(indexPath);
app.initiateRequest(selectedItem.value);
}
}
}
}Please dont understand it wrong. Iam not asking to get help without doing anything by myself. Iam new to this and iam struggling to understand the whole material. For now iam happy, that i've understood this part.
So this is done for me.
Regards
Maddin
03-19-2013 07:08 AM
Hi,
For those who are interessted how the xml file looks like, at the moment:
<model>
<header title="A">
<city title="Algiers" value="36.76,3.05" />
<city title="Andorra la Vella" value="42.48,1.50" />
...
</header>
...
</model>
Regards,
Maddin