XmlListModel窗口卡住了

时间:2017-06-13 18:38:00

标签: xml qt qml

将xml数据加载到ListView的最佳实践是什么? 我使用这段代码:

XmlListModel{
    id:listmodel
    source: "http://api.flickr.com/services/feeds/photos_public.gne?format=atom&tags=cats"
    query: "/feed/entry"
    namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"
    XmlRole { name:"title"; query: "title/string()" }
    XmlRole { name:"imagesource"; query: "link[@rel=\"enlosure\"]/@href/string()" }
     onCountChanged: console.log("count:", count)
}
BusyIndicator{
    anchors.fill: parent
    running: XmlListModel.status == XmlListModel.Loading
}

ListModel{
    id: fruitModel
    property string language: "en"
    ListElement{
        title: "test"
    }
}

ListView{
    ScrollBar.vertical: ScrollBar { }
    id: listview
    width: parent.width
    height: parent.height
    model:listmodel

    delegate ... ... ..

效果很好,但是数据加载时窗口停止响应。我试图添加一个繁忙的指标,但这没有帮助。 我可以从后台加载数据并显示繁忙的指示符或类似内容吗?

0 个答案:

没有答案
相关问题