10-22-2012 11:25 AM
I need help to display an xml that has different levels, my xml is:
<root>
<header title="Frutas"/>
<sample name="Manzana" icon= "manzana.png">
<descripcion text="la manzana es roja" infotext="Manzana"/>
</sample>
<sample name="Pera" icon= "pera.png">
<descripcion text="la pera es verde" infotext="pera"/>
</sample>
<sample name="orange" icon= "orange.png">
<descripcion text="the orange is orange" infotext="Manzana"/>
</sample>
</root>
how to make when selecting a fruit, showing me his description?
Thx for helpme
10-22-2012 01:28 PM - edited 10-22-2012 01:31 PM
ListView {
dataModel: XmlDataModel {
source: "xmlfile.xml"
}
listItemComponents: [
ListItemComponent {
type: "sample"
Container {
Label {
text: ListItemData.name
}
}
},
ListItemComponent {
type: "description"
Container {
Label {
text: ListItemData.text
}
}
}
]
}
Take a look at the cascades cookbook qml main.qml file (and the recipeitem.qml file) this will give you a good understanding of the listview and using xml documents.