Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. import QtQuick 1.0
  2.  
  3. Rectangle {
  4. id: rectangle5
  5. width: 500
  6. height: 500
  7.  
  8. ListModel {
  9. id: myModel;
  10. ListElement { artist: "foo 1"; duration: 7.36 }
  11. ListElement { artist: "foo 2"; duration: 4.45 }
  12. ListElement { artist: "foo 3"; duration: 6.64 }
  13. ListElement { artist: "foo 4"; duration: 1.24 }
  14. ListElement { artist: "foo 5"; duration: 3.32 }
  15. ListElement { artist: "foo 6"; duration: 9.51 }
  16. ListElement { artist: "foo 1"; duration: 7.36 }
  17. ListElement { artist: "foo 2"; duration: 4.45 }
  18. ListElement { artist: "foo 3"; duration: 6.64 }
  19. ListElement { artist: "foo 4"; duration: 1.24 }
  20. ListElement { artist: "foo 5"; duration: 3.32 }
  21. ListElement { artist: "foo 6"; duration: 9.51 }
  22. }
  23.  
  24. VisualDataModel {
  25. id: visualModel
  26. model: myModel
  27. delegate: Component {
  28. Rectangle {
  29. id: rectangle1
  30. x: 100
  31. y: 0
  32. width: 218
  33. height: 34
  34. gradient: Gradient {
  35. GradientStop {
  36. position: 0
  37. color: "#2eaf2c"
  38. }
  39.  
  40. GradientStop {
  41. position: 1
  42. color: "#000000"
  43. }
  44. }
  45. border.color: "#000000"
  46. Text { anchors.centerIn: parent; text: "Artist: " + artist + " duration: " + duration }
  47.  
  48. MouseArea {
  49. anchors.fill: parent
  50. onClicked: list_view1.currentIndex = index
  51. }
  52. }
  53. }
  54. }
  55.  
  56. Component {
  57. id: highlight
  58. Rectangle {
  59. width: 1280; height: 40
  60. color: "lightsteelblue"; radius: 5
  61. opacity: 1.0
  62. SpringAnimation on y {
  63. to: list_view1.currentItem.y
  64. spring: 3
  65. damping: 0.2
  66. }
  67. }
  68. }
  69.  
  70. ListView {
  71. id: list_view1
  72. x: 29
  73. y: 124
  74. width: 439
  75. height: 253
  76. clip: true
  77. model: visualModel
  78. highlight: highlight
  79. highlightFollowsCurrentItem: true
  80. }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement