Advertisement
Guest User

QML ListView sample snippet

a guest
Jul 21st, 2011
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. import QtQuick 1.1
  2. import com.meego 1.0
  3.  
  4. Page {
  5. id: mainPage
  6. tools: commonTools
  7. ListModel {
  8. id: nameModel
  9. ListElement { name: "Alice" }
  10. ListElement { name: "Bob" }
  11. ListElement { name: "Jane" }
  12. ListElement { name: "Harry" }
  13. ListElement { name: "Wendy" }
  14. }
  15. Component {
  16. id: nameDelegate
  17. Text {
  18. text: name;
  19. font.pixelSize: 24
  20. }
  21. }
  22. ListView {
  23. anchors.fill: parent
  24. clip: true
  25. model: nameModel
  26. delegate: nameDelegate
  27. header: bannercomponent
  28. footer: Rectangle {
  29. width: parent.width; height: 30;
  30. gradient: clubcolors
  31. }
  32. highlight: Rectangle {
  33. width: parent.width
  34. color: "lightgray"
  35. }
  36. }
  37.  
  38. Component { //instantiated when header is processed
  39. id: bannercomponent
  40. Rectangle {
  41. id: banner
  42. width: parent.width; height: 50
  43. gradient: clubcolors
  44. border {color: "#9EDDF2"; width: 2}
  45. Text {
  46. anchors.centerIn: parent
  47. text: "Club Members"
  48. font.pixelSize: 32
  49. }
  50. }
  51. }
  52. Gradient {
  53. id: clubcolors
  54. GradientStop { position: 0.0; color: "#8EE2FE"}
  55. GradientStop { position: 0.66; color: "#7ED2EE"}
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement