VolumeIndicator.qml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * Copyright (c) 2012 Nokia Corporation.
  3. */
  4. import QtQuick 1.1
  5. import com.nokia.symbian 1.1
  6. Slider {
  7. id: volumeIndicator
  8. orientation: Qt.Vertical
  9. maximumValue: 1
  10. minimumValue: 0
  11. stepSize: 0.1
  12. rotation: 180
  13. opacity: 1
  14. state: "hide"
  15. // When the value has changed the indicator is shown, and the hide
  16. // Timer will be restarted.
  17. onValueChanged: {
  18. volumeIndicator.state = "";
  19. hideTimer.restart();
  20. }
  21. Timer {
  22. id: hideTimer
  23. interval: 1000
  24. running: true
  25. onTriggered: {
  26. volumeIndicator.state = "hide";
  27. }
  28. }
  29. // Mouse area to grap all the events, as the indicator is not interactive.
  30. MouseArea {
  31. anchors.fill: parent
  32. }
  33. states: [
  34. State {
  35. name: "hide"
  36. PropertyChanges {
  37. target: volumeIndicator
  38. opacity: 0
  39. }
  40. }
  41. ]
  42. transitions: [
  43. Transition {
  44. from: ""
  45. to: "hide"
  46. reversible: true
  47. NumberAnimation {
  48. property: "opacity"
  49. duration: visual.animationDurationLong
  50. easing.type: Easing.InOutQuad
  51. }
  52. }
  53. ]
  54. }