Guest User

Untitled

a guest
Aug 21st, 2012
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
  2. import QtQuick 1.1
  3. import com.nokia.meego 1.1
  4. import "Constants.js" as Constants
  5.  
  6. Rectangle {
  7.  
  8. property alias list: list
  9. property alias listModel: list.model
  10. property alias mouseArea: headerMouseArea
  11. property alias headerText: headerText
  12. property alias listContainer: listContainer
  13.  
  14. id: rootContainer
  15. width: parent.width
  16. height: header.height + listContainer.height
  17. Rectangle {
  18. id: header
  19. height: Constants.appHeaderHeight
  20. width: parent.width
  21. color: "lightgrey"
  22.  
  23. ToolIcon {
  24. id: arrow
  25. iconId: "icon-m-common-drilldown-arrow" + (theme.inverted ? "-inverse" : "")
  26. anchors.left: header.left
  27. anchors.verticalCenter: parent.verticalCenter
  28. anchors.leftMargin: -10
  29. }
  30. Text {
  31. id: headerText
  32. anchors.left: arrow.right
  33. anchors.leftMargin: -20
  34. font.pixelSize: Constants.expandingListViewHeaderSize
  35. anchors.verticalCenter: parent.verticalCenter
  36. }
  37. MouseArea {
  38. id: headerMouseArea
  39. anchors.fill: parent
  40. onClicked: {
  41. if (list.state == "close") {
  42. list.state = "open";
  43. } else {
  44. list.state = "close";
  45. }
  46. }
  47. }
  48. Rectangle {
  49. id: listContainer
  50. width: parent.width
  51. height: 0
  52. anchors.top: header.bottom
  53. ListView {
  54. id: list
  55. anchors.fill: parent
  56. clip: true
  57. state: "close"
  58. states: [
  59. State {
  60. name: "open"
  61. PropertyChanges { target: listContainer; height: list.count * Constants.expandingListViewItemHeight > Constants.expandingListViewItemHeight * 5 ? Constants.expandingListViewItemHeight * 5 : list.count * Constants.expandingListViewItemHeight; }
  62. PropertyChanges { target: arrow; rotation: 90; }
  63. },
  64. State {
  65. name: "close"
  66. PropertyChanges { target: listContainer; height: 0; }
  67. PropertyChanges { target: arrow; rotation: 0; }
  68. }
  69. ]
  70. transitions: [
  71. Transition {
  72. from: "*"; to: "open"
  73. NumberAnimation { properties: "height"; easing.type: Easing.OutBounce; duration: 1000 }
  74. NumberAnimation { properties: "rotation"; easing.type: Easing.OutBounce; duration: 1000 }
  75. },
  76. Transition {
  77. from: "*"; to: "close"
  78. NumberAnimation { properties: "height"; easing.type: Easing.OutBounce; duration: 1000 }
  79. NumberAnimation { properties: "rotation"; easing.type: Easing.OutBounce; duration: 1000 }
  80. }
  81. ]
  82. }
  83.  
  84. }
  85. }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment