Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.0
- import QtQuick.XmlListModel 2.0
- import Ubuntu.Components.ListItems 0.1 as ListItem
- import Ubuntu.Components.Popups 0.1 as Popups
- import Ubuntu.Components 0.1
- import "components"
- MainView {
- objectName: "mainView"
- applicationName: "com.ubuntu.developer.enderlance.Chemistry"
- width: units.gu(50)
- height: units.gu(75)
- headerColor: "#464646"
- backgroundColor: "#2A2A2B"
- footerColor: "#2A2A2B"
- Component
- {
- id: popupInfo
- Popups.Dialog
- {
- id: popupInfoDialog
- title: "Credits"
- text: "App by Brendan Wilson\nContact: belancew@gmail.com\nDatabase by Tyler Raber"
- Button
- {
- id: loginButton
- text: "Back"
- color: "green"
- onClicked:
- {
- PopupUtils.close(popupInfoDialog)
- }
- }
- }
- }
- ToolbarItems
- {
- id: toolbar
- ToolbarButton
- {
- id: infoButton
- text: i18n.tr("Info")
- iconSource: Qt.resolvedUrl("icons/info.png")
- onTriggered:
- {
- PopupUtils.open(popupInfo)
- }
- }
- }
- PageStack {
- id: stack
- Component.onCompleted: stack.push(mainMenu)
- Page {
- id: mainMenu
- tools: toolbar
- title: i18n.tr("Chemistry")
- Column {
- spacing: units.gu(1)
- anchors {
- margins: units.gu(2)
- fill: parent
- }
- Button {
- objectName: "ptebutton"
- width: parent.width
- text: i18n.tr("List the Elements")
- onClicked: {
- stack.push(ptepage)
- ptepage.visible = true
- }
- }
- }
- }
- Page {
- id: ptepage
- title: "Elements"
- tools: toolbar
- visible: false
- Column {
- spacing: units.gu(1)
- anchors.fill: parent
- ListView {
- id: ptelistview
- height: parent.height
- XmlListModel {
- id: ptelistmodel
- source: "xml/pte.xml"
- query: "/periodic/table"
- XmlRole { name: "element"; query: "Element/string()" }
- }
- model: ptelistmodel
- delegate: Text {
- text: element
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement