ToolBar.qml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import QtQuick 1.1
  2. Rectangle {
  3. id: toolBar
  4. height: 80
  5. width: parent.width
  6. anchors.left: parent.left
  7. BorderImage {
  8. z: -1
  9. anchors.fill: parent
  10. anchors { leftMargin: -8; topMargin: -10; rightMargin: -8; bottomMargin: -6 }
  11. border { left: 10; top: 10; right: 10; bottom: 10 }
  12. source: "qrc:/qml/images/shadow.png";
  13. smooth: true
  14. }
  15. gradient: Gradient {
  16. GradientStop { position: 0; color: "#a7a7a7" }
  17. GradientStop { position: 1; color: "#666666" }
  18. }
  19. property int pauseAnim: 0
  20. property int durationAnim: 10
  21. function show() {
  22. toolBar.state = "normal"
  23. }
  24. function hide() {
  25. toolBar.state = "hide"
  26. }
  27. states: [
  28. State {
  29. name: "normal"
  30. AnchorChanges {
  31. target: toolBar
  32. anchors.bottom: toolBar.parent.bottom
  33. }
  34. },
  35. State {
  36. name: "hide"
  37. AnchorChanges {
  38. target: toolBar
  39. anchors.top: toolBar.parent.bottom
  40. }
  41. }
  42. ]
  43. transitions: Transition {
  44. SequentialAnimation {
  45. PauseAnimation { duration: toolBar.pauseAnim }
  46. AnchorAnimation { duration: toolBar.durationAnim; easing.type: Easing.OutElastic }
  47. }
  48. }
  49. state: "hide"
  50. Component.onCompleted: toolBar.state = "normal"
  51. }