Advertisement
EnderLance

Chemistry.qml

Jan 31st, 2014
2,747
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
q/kdb+ 2.84 KB | None | 0 0
  1. import QtQuick 2.0
  2. import QtQuick.XmlListModel 2.0
  3. import Ubuntu.Components.ListItems 0.1 as ListItem
  4. import Ubuntu.Components.Popups 0.1 as Popups
  5. import Ubuntu.Components 0.1
  6. import "components"
  7.  
  8. MainView {
  9.     objectName: "mainView"
  10.  
  11.     applicationName: "com.ubuntu.developer.enderlance.Chemistry"
  12.  
  13.     width: units.gu(50)
  14.     height: units.gu(75)
  15.  
  16.     headerColor: "#464646"
  17.     backgroundColor: "#2A2A2B"
  18.     footerColor: "#2A2A2B"
  19.  
  20.     Component
  21.     {
  22.         id: popupInfo
  23.  
  24.         Popups.Dialog
  25.         {
  26.             id: popupInfoDialog
  27.  
  28.             title: "Credits"
  29.             text: "App by Brendan Wilson\nContact: belancew@gmail.com\nDatabase by Tyler Raber"
  30.  
  31.             Button
  32.             {
  33.                 id: loginButton
  34.  
  35.                 text: "Back"
  36.                 color: "green"
  37.                 onClicked:
  38.                 {
  39.                     PopupUtils.close(popupInfoDialog)
  40.                 }
  41.             }
  42.         }
  43.     }
  44.  
  45.     ToolbarItems
  46.     {
  47.         id: toolbar
  48.         ToolbarButton
  49.         {
  50.             id: infoButton
  51.             text: i18n.tr("Info")
  52.  
  53.             iconSource: Qt.resolvedUrl("icons/info.png")
  54.  
  55.             onTriggered:
  56.             {
  57.                 PopupUtils.open(popupInfo)
  58.             }
  59.         }
  60.     }
  61.  
  62.     PageStack {
  63.         id: stack
  64.  
  65.         Component.onCompleted: stack.push(mainMenu)
  66.  
  67.         Page {
  68.             id: mainMenu
  69.  
  70.             tools: toolbar
  71.  
  72.             title: i18n.tr("Chemistry")
  73.  
  74.             Column {
  75.                 spacing: units.gu(1)
  76.                 anchors {
  77.                     margins: units.gu(2)
  78.                     fill: parent
  79.                 }
  80.  
  81.                 Button {
  82.                     objectName: "ptebutton"
  83.                     width: parent.width
  84.  
  85.                     text: i18n.tr("List the Elements")
  86.  
  87.                     onClicked: {
  88.                         stack.push(ptepage)
  89.                         ptepage.visible = true
  90.                     }
  91.                 }
  92.             }
  93.         }
  94.  
  95.         Page {
  96.             id: ptepage
  97.  
  98.             title: "Elements"
  99.  
  100.             tools: toolbar
  101.  
  102.             visible: false
  103.  
  104.             Column {
  105.                 spacing: units.gu(1)
  106.                 anchors.fill: parent
  107.  
  108.                 ListView {
  109.                     id: ptelistview
  110.  
  111.                     height: parent.height
  112.  
  113.                     XmlListModel {
  114.                         id: ptelistmodel
  115.                         source: "xml/pte.xml"
  116.                         query: "/periodic/table"
  117.  
  118.                         XmlRole { name: "element"; query: "Element/string()" }
  119.                     }
  120.  
  121.                     model: ptelistmodel
  122.  
  123.                     delegate: Text {
  124.                         text: element
  125.                     }
  126.                 }
  127.             }
  128.         }
  129.     }
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement