XML <image size="small">34/274359.jpg</image><image size="medium"> 64/274359.jpg</image><image size="large">274359.jpg</image><image size="extralarge">252/274359.jpg</image><image size="mega"> Mon.jpg</image>
XmlListModel { id: xmlModel source: "ФАЙЛ" query: "/image" XmlRole { name: "size"; query: "@size/string()" } XmlRole { name: "image"; query: "image/string()" }}
import QtQuick 1.0Rectangle { width: 200 height: 200 XmlListModel { id: itemmodel xml: "<list><item id=\"1\">This i want</item><item id=\"2\">This i want2</item></list>" query: "/list/item" XmlRole { name: "itemNum" query: "@id/string()" } XmlRole { name: "itemContant" query: "string()" } } ListView { width: 180; height: 300 model: itemmodel delegate: Rectangle { height: 40 width: 100 Text { text: "Item Id:" + itemNum + "; Item Data:" + itemContant } } }}
C++ (Qt)Rectangle { width: parent.width height: parent.height XmlListModel { id: itemmodel source: "http://ws.audioscrobbler.com/2.0/?method=geo.gettopartists&country=spain&api_key=fef91516474dea0dca023e9281fb5c11" query: "/lfm/topartists/artist" XmlRole { name: "title" query: "name/string()" } XmlRole { name: "image" query: "image/string()" } } ListView { width: parent.width; height: parent.height model: itemmodel delegate: Item { id: delegate height: column.height + 40 width: delegate.ListView.view.width Column { id: column x: 20; y: 20 width: parent.width - 40 Text { id: titleText text: title; width: parent.width; wrapMode: Text.WordWrap font { bold: true; family: "Helvetica"; pointSize: 16 } } Image { id: img source: title1 height: 100 width: 100 } Text { id: descriptionText width: parent.width; text: image wrapMode: Text.WordWrap; font.family: "Helvetica" } } Rectangle { width: parent.width; height: 1; color: "#cccccc" anchors.bottom: parent.bottom } } }}
XmlRole { name: "small_image" query: "строка_запроса"}