QuiaPhotoItem.qml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import Qt 4.7
  2. Rectangle {
  3. id: photoItem
  4. property string thumbUrl
  5. property string bigUrl
  6. property int imageWidth
  7. property int imageHeight
  8. width: imageWidth
  9. height: imageHeight
  10. /*{
  11. //return Math.floor((100-50)*Math.random()) + 51;
  12. return 200;
  13. }*/
  14. height: 170
  15. color: "lightgrey"
  16. Image {
  17. id: currentImage
  18. width: parent.width-10
  19. height: parent.height-10
  20. source: thumbUrl
  21. onProgressChanged:
  22. {
  23. loadingImage.opacity = 1-currentImage.progress;
  24. }
  25. }
  26. Image {
  27. id: loadingImage
  28. anchors.horizontalCenter: parent.horizontalCenter
  29. anchors.verticalCenter: parent.verticalCenter
  30. width: 30
  31. height: 30
  32. z: 2
  33. opacity: 1
  34. source: "images/loading.png"
  35. smooth: true
  36. }
  37. states: [
  38. State {
  39. name: "bigImage"
  40. PropertyChanges {
  41. target: currentImage
  42. source: bigUrl
  43. }
  44. }
  45. ]
  46. }