Advertisement
Guest User

Drawer in Silica

a guest
Oct 2nd, 2015
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. Drawer {
  2. id: drawer
  3.  
  4. anchors.fill: parent
  5. dock: page.isPortrait ? Dock.Top : Dock.Left
  6.  
  7. background: SilicaListView {
  8. anchors.fill: parent
  9. model: 5
  10.  
  11. header: PageHeader { title: "Drawer" }
  12.  
  13. PullDownMenu { // The PullDownMenu is inside the ListView, see?
  14. MenuItem {
  15. text: "Option 1"
  16. }
  17. MenuItem {
  18. text: "Option 2"
  19. }
  20. }
  21. VerticalScrollDecorator {}
  22.  
  23. delegate: ListItem {
  24. id: listItem
  25.  
  26. Label {
  27. x: Theme.horizontalPageMargin
  28. text: "List Item " + modelData
  29. anchors.verticalCenter: parent.verticalCenter
  30. color: listItem.highlighted ? Theme.highlightColor : Theme.primaryColor
  31. }
  32. }
  33. }
  34.  
  35. SilicaFlickable {
  36. anchors {
  37. fill: parent
  38. leftMargin: page.isPortrait ? 0 : controlPanel.visibleSize
  39. topMargin: page.isPortrait ? controlPanel.visibleSize : 0
  40. rightMargin: page.isPortrait ? 0 : progressPanel.visibleSize
  41. bottomMargin: page.isPortrait ? progressPanel.visibleSize : 0
  42. }
  43.  
  44. contentHeight: column.height + Theme.paddingLarge
  45.  
  46. VerticalScrollDecorator {}
  47.  
  48. MouseArea {
  49. enabled: drawer.open
  50. anchors.fill: column
  51. onClicked: drawer.open = false
  52. }
  53.  
  54. Column {
  55. id: column
  56. spacing: Theme.paddingLarge
  57. width: parent.width
  58. enabled: !drawer.opened
  59.  
  60. PageHeader { title: "Popup Panels" }
  61.  
  62. Button {
  63. text: controlPanel.open ? "Hide controls" : "Show controls"
  64. onClicked: controlPanel.open = !controlPanel.open
  65. anchors.horizontalCenter: parent.horizontalCenter
  66. }
  67.  
  68. Button {
  69. text: progressPanel.open ? "Hide progress" : "Show progress"
  70. onClicked: progressPanel.open = !progressPanel.open
  71. anchors.horizontalCenter: parent.horizontalCenter
  72. }
  73.  
  74. Button {
  75. text: "Open drawer"
  76. onClicked: drawer.open = true
  77. anchors.horizontalCenter: parent.horizontalCenter
  78. }
  79. }
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement