Advertisement
Guest User

Untitled

a guest
Apr 25th, 2013
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. import QtQuick 2.0
  2. import Ubuntu.Components 0.1
  3.  
  4. /*!
  5. \brief MainView with Tabs element.
  6. First Tab has a single Label and
  7. second Tab has a single ToolbarAction.
  8. */
  9.  
  10. MainView {
  11. // objectName for functional testing purposes (autopilot-qt5)
  12. objectName: "mainView"
  13. // Note! applicationName needs to match the .desktop filename
  14. applicationName: "helloworldtabbed"
  15.  
  16. width: units.gu(100)
  17. height: units.gu(75)
  18.  
  19. Component {
  20. id: helloTab
  21. Page {
  22. Column {
  23. anchors.fill: parent
  24. Label {
  25. text: i18n.tr("Swipe from right to left to change tab.")
  26. }
  27. }
  28. }
  29. }
  30.  
  31. Tabs {
  32. id: tabs
  33.  
  34. // First tab begins here
  35. Tab {
  36. objectName: "Tab1"
  37.  
  38. title: i18n.tr("Hello..")
  39.  
  40. // Tab content begins here
  41. page:
  42. // Works if uncommenting these lines
  43. // Page {
  44. // Column {
  45. // anchors.fill: parent
  46. // Label {
  47. // text: i18n.tr("Swipe from right to left to change tab.")
  48. // }
  49. // }
  50. // }
  51.  
  52. // And commenting away these lines
  53. Loader {
  54. sourceComponent: helloTab
  55. }
  56. }
  57.  
  58. // Second tab begins here
  59. Tab {
  60. objectName: "Tab2"
  61.  
  62. title: i18n.tr("..Toolbar!")
  63. page: Page {
  64. tools: ToolbarActions {
  65. Action {
  66. objectName: "action"
  67.  
  68. iconSource: Qt.resolvedUrl("toolbarIcon.png")
  69. text: i18n.tr("Tap me!")
  70.  
  71. onTriggered: {
  72. label.text = i18n.tr("Toolbar tapped")
  73. }
  74. }
  75. }
  76.  
  77. Column {
  78. anchors.centerIn: parent
  79. Label {
  80. id: label
  81. objectName: "label"
  82.  
  83. text: i18n.tr("Swipe from bottom to up to reveal the toolbar.")
  84. }
  85. }
  86. }
  87. }
  88. }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement