1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-06 19:12:30 +01:00
ScreenPlay/ScreenPlayWorkshop/qml/InstalledItemImage.qml

61 lines
1.2 KiB
QML
Raw Permalink Normal View History

import QtQuick
2020-08-20 17:21:09 +02:00
Item {
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
source: root.sourceImage.trim()
2020-08-20 17:21:09 +02:00
onStatusChanged: {
if (image.status === Image.Ready) {
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";
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
}
}
]
}