[SailfishDevel] Getting simple XML to show on the emulator

helicalgear . helicalgear at gmail.com
Wed May 13 06:07:22 UTC 2015


Hi,

Is your first question "How you should do to display the data which are get
from the XML" ?

I think you should add "delegate" property and some codes to do it.

import QtQuick 2.0

import Sailfish.Silica 1.0

import QtQuick.XmlListModel 2.0


Page{

    id: root


    XmlListModel{

        id:noteXml

        source:"http://www.w3schools.com/xml/note.xml"

        query:"/note"

        XmlRole{name: "body"; query: "body/string()"}

    }


    SilicaListView{

         id:noteView

         width: parent.width

         height: parent.height

         anchors.centerIn: parent


         header: PageHeader{

             title: "Note"

         }


         model:noteXml


         delegate: BackgroundItem {

             id: delegate


             Text {

                 font.pixelSize: Theme.fontSizeLarge

                 color: Theme.primaryColor

                 text: body

             }

         }

    }

}


Best regards,
-- 
R.Kake!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20150513/1599921f/attachment.html>


More information about the Devel mailing list