ArtImage.qml 910 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import QtQuick 2.5
  2. import PictureModel 1.0
  3. Rectangle {
  4. property var effect
  5. property int modelIndex
  6. color: "black"
  7. height: Math.ceil(width/imageModel.data(modelIndex, PictureModel.RatioRole))
  8. width: parent.width
  9. Image {
  10. opacity: 0
  11. anchors.fill: parent
  12. asynchronous: true
  13. fillMode: Image.PreserveAspectFit
  14. source: imageModel.data(modelIndex)
  15. mirror: globalSettings.randomlyMirrorArt && (Math.random() < 0.5)
  16. smooth: globalSettings.smoothArt
  17. sourceSize.height: height
  18. sourceSize.width: width
  19. Behavior on opacity {
  20. NumberAnimation { duration: 1000 }
  21. }
  22. onStatusChanged: {
  23. if (status === Image.Ready) {
  24. opacity = 1
  25. }
  26. }
  27. }
  28. Component.onCompleted: {
  29. modelIndex = Math.floor(Math.random()*imageModel.count)
  30. }
  31. }