Guest User

Untitled

a guest
Oct 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.31 KB | None | 0 0
  1. import QtQuick 2.11
  2. import QtQuick.Controls 2.11
  3.  
  4. Rectangle {
  5. width: 220
  6. height: 300
  7.  
  8. gradient: Gradient {
  9. GradientStop {
  10. position: 0.0
  11. color: "#f6f6f6"
  12. }
  13. GradientStop {
  14. position: 1.0
  15. color: "#d7d7d7"
  16. }
  17. }
  18.  
  19. Popup {
  20. id: popup
  21. x: 100
  22. y: 100
  23. width: 200
  24. height: 300
  25. modal: true
  26. focus: true
  27. closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
  28. property int pindex: 0
  29. MouseArea {
  30. anchors.fill: parent
  31. onClicked: {
  32. print(pindex)
  33. }
  34. }
  35. }
  36.  
  37. ListModel {
  38. id: actionModel
  39.  
  40. ListElement {
  41. name: "Copenhagen"
  42. hello: function (value) {
  43. console.log(value + ": You clicked Copenhagen!")
  44. //popup.pindex = 1
  45. //popup.open()
  46. }
  47. hello1: function (value) {
  48. console.log(value + ": You unclicked Copenhagen!")
  49. }
  50. }
  51.  
  52. ListElement {
  53. name: "Helsinki"
  54. hello: function (value) {
  55. console.log(value + ": Helsinki here!")
  56. }
  57. hello1: function (value) {
  58. console.log(value + ": You unclicked Copenhagen!")
  59. }
  60. }
  61.  
  62. ListElement {
  63. name: "Oslo"
  64. hello: function (value) {
  65. console.log(value + ": Hei Hei fra Oslo!")
  66. }
  67. hello1: function (value) {
  68. console.log(value + ": You unclicked Copenhagen!")
  69. }
  70. }
  71.  
  72. ListElement {
  73. name: "Stockholm"
  74. hello: function (value) {
  75. console.log(value + ": Stockholm calling!")
  76. }
  77. hello1: function (value) {
  78. console.log(value + ": You unclicked Copenhagen!")
  79. }
  80. }
  81. }
  82.  
  83. ListView {
  84. anchors.fill: parent
  85. anchors.margins: 20
  86.  
  87. clip: true
  88.  
  89. model: actionModel
  90.  
  91. delegate: actionDelegate
  92. spacing: 5
  93.  
  94. focus: true
  95. }
  96.  
  97. Component {
  98. id: actionDelegate
  99.  
  100. Pane {
  101. background: Rectangle {
  102. color: "#157efb"
  103. }
  104. Row {
  105. Label {
  106. text: name
  107. MouseArea {
  108. anchors.fill: parent
  109. onClicked: {
  110. popup.pindex = 1
  111. popup.open()
  112. //hello(index)
  113. }
  114. }
  115. }
  116. //Image {}
  117. Label {
  118. text: " - "
  119. MouseArea {
  120. anchors.fill: parent
  121. onClicked: hello1(index)
  122. }
  123. }
  124. Label {
  125. text: " + "
  126. MouseArea {
  127. anchors.fill: parent
  128. onClicked: {
  129. hello(index)
  130. }
  131. }
  132. }
  133. }
  134. }
  135. }
  136. }
Advertisement
Add Comment
Please, Sign In to add comment