1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2024-05-18 20:02:43 +00:00
harbour-sailfin/qml/components/RemoteImage.qml

34 lines
925 B
QML

import QtQuick 2.6
import Sailfish.Silica 1.0
/**
* An image for "remote" images (loaded over e.g. http), with a spinner and a fallback image
*/
HighlightImage {
property string fallbackImage
property bool usingFallbackImage
asynchronous: true
BusyIndicator {
anchors.centerIn: parent
running: parent.status == Image.Loading
}
Rectangle {
id: fallbackBackground
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0.0; color: Theme.highlightColor; }
GradientStop { position: 1.0; color: Theme.highlightDimmerColor; }
}
visible: parent.status == Image.Error || parent.status == Image.Null
}
HighlightImage {
id: fallbackImageItem
anchors.centerIn: parent
visible: parent.status == Image.Error || parent.status == Image.Null
source: fallbackImage ? fallbackImage : "image://theme/icon-m-question"
}
}