Advertisement
Guest User

/qml/pages/FirstPage.qml

a guest
May 13th, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 0.92 KB | None | 0 0
  1. import QtQuick 2.0
  2. import Sailfish.Silica 1.0
  3. import QtQuick.XmlListModel 2.0
  4.  
  5. Page {
  6.     id: page
  7.  
  8.     XmlListModel {
  9.         id:menuXml
  10.         source:"http://www.w3schools.com/xml/simple.xml"
  11.         query:"/breakfast_menu/food"
  12.         XmlRole {name:"name";query:"name/string()"}
  13.         XmlRole {name:"price";query:"price/string()"}
  14.     }
  15.  
  16.     SilicaListView {
  17.         id:menuView
  18.         width:parent.width
  19.         height:parent.height
  20.  
  21.         header: PageHeader{
  22.             title:"Breakfast Menu"
  23.         }
  24.  
  25.         model:menuXml
  26.  
  27.         delegate:BackgroundItem{
  28.             id:delegate
  29.  
  30.             Text{
  31.                 font.pixelSize: Theme.fontSizeLarge
  32.                 color:Theme.primaryColor
  33.                 text:name
  34.             }
  35.             Text{
  36.                 font.pixelSize: 15
  37.                 color:Theme.primaryColor
  38.                 text:price
  39.             }
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement