2021-09-10 12:45:15 +02:00
|
|
|
import QtQuick
|
2020-08-20 17:21:09 +02:00
|
|
|
|
|
|
|
Item {
|
2023-01-19 14:09:06 +01:00
|
|
|
id: root
|
2020-08-20 17:21:09 +02:00
|
|
|
|
|
|
|
property string sourceImage
|
|
|
|
property string sourceImageGIF
|
|
|
|
|
2021-05-16 19:37:55 +02:00
|
|
|
width: 320
|
|
|
|
height: 121
|
|
|
|
state: "loading"
|
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
Image {
|
|
|
|
id: image
|
2021-05-16 19:37:55 +02:00
|
|
|
|
2020-08-20 17:21:09 +02:00
|
|
|
anchors.fill: parent
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
2023-01-19 14:09:06 +01:00
|
|
|
source: root.sourceImage.trim()
|
2020-08-20 17:21:09 +02:00
|
|
|
onStatusChanged: {
|
|
|
|
if (image.status === Image.Ready) {
|
2023-01-19 14:09:06 +01:00
|
|
|
root.state = "loaded";
|
2020-08-20 17:21:09 +02:00
|
|
|
} else if (image.status === Image.Error) {
|
2021-05-16 19:37:55 +02:00
|
|
|
source = "images/missingPreview.png";
|
2023-01-19 14:09:06 +01:00
|
|
|
root.state = "loaded";
|
2020-08-20 17:21:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "loading"
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
|
|
|
opacity: 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: "loaded"
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: image
|
|
|
|
opacity: 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
transitions: [
|
|
|
|
Transition {
|
|
|
|
from: "loading"
|
|
|
|
to: "loaded"
|
|
|
|
|
|
|
|
NumberAnimation {
|
|
|
|
target: image
|
|
|
|
property: "opacity"
|
|
|
|
duration: 300
|
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|