ProgressBar.qml 888 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Copyright (c) 2011 Nokia Corporation.
  3. */
  4. import QtQuick 1.0
  5. Item {
  6. id: progressbar
  7. property int minimum: 0
  8. property int maximum: 100
  9. property int value: 0
  10. property alias color: gradient1.color
  11. property alias secondColor: gradient2.color
  12. width: 250; height: 23
  13. clip: true
  14. Rectangle {
  15. id: highlight
  16. property int widthDest: ((progressbar.width * (value - minimum)) / (maximum - minimum) - 6)
  17. width: highlight.widthDest
  18. Behavior on width { SmoothedAnimation { velocity: 1200 } }
  19. anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: 3 }
  20. radius: 1
  21. gradient: Gradient {
  22. GradientStop { id: gradient1; position: 0.0 }
  23. GradientStop { id: gradient2; position: 1.0 }
  24. }
  25. }
  26. }