RatingsItem.qml 794 B

123456789101112131415161718192021222324252627282930313233
  1. import QtQuick 2.0
  2. Item {
  3. property real rating: 5.0
  4. width: emptyRatingStarsImage.width + ratingTextItem.paintedWidth + 4
  5. height: 32
  6. // TODO: Implement ratings in shader + animations, instead of clipping trick
  7. Image {
  8. id: emptyRatingStarsImage
  9. source: "images/stars2.png"
  10. }
  11. Item {
  12. id: ratingImageItem
  13. height: 32
  14. width: (36 * rating) - 2
  15. clip: true
  16. Image {
  17. source: "images/stars.png"
  18. }
  19. }
  20. Text {
  21. id: ratingTextItem
  22. anchors.left: emptyRatingStarsImage.right
  23. anchors.leftMargin: 4
  24. anchors.verticalCenter: ratingImageItem.verticalCenter
  25. color: "#ffffff"
  26. font.pixelSize: settings.fontM
  27. text: "(" + rating.toFixed(1) + ")"
  28. }
  29. }