Spectral/qml/component/ImageStatus.qml

53 lines
1.3 KiB
QML
Raw Normal View History

2018-02-23 14:39:14 +00:00
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtGraphicalEffects 1.0
2018-03-04 12:05:09 +00:00
Item {
2018-03-04 14:40:48 +00:00
property bool statusIndicator: false
property bool opaqueBackground: false
2018-03-04 12:05:09 +00:00
property alias source: avatar.source
2018-03-02 15:05:32 +00:00
2018-03-04 12:05:09 +00:00
Rectangle {
width: parent.width
height: parent.width
radius: parent.width / 2
color: "white"
2018-03-04 14:40:48 +00:00
visible: opaqueBackground
2018-03-04 12:05:09 +00:00
}
Image {
id: avatar
width: parent.width
height: parent.width
2018-02-23 14:39:14 +00:00
2018-03-04 12:05:09 +00:00
mipmap: true
layer.enabled: true
fillMode: Image.PreserveAspectCrop
2018-03-04 14:40:48 +00:00
sourceSize.width: parent.width
sourceSize.height: parent.width
2018-02-23 14:39:14 +00:00
2018-03-04 12:05:09 +00:00
layer.effect: OpacityMask {
maskSource: Item {
2018-02-23 14:39:14 +00:00
width: avatar.width
height: avatar.width
2018-03-04 12:05:09 +00:00
Rectangle {
anchors.centerIn: parent
width: avatar.width
height: avatar.width
radius: avatar.width / 2
}
2018-02-23 14:39:14 +00:00
}
}
2018-03-04 12:05:09 +00:00
Rectangle {
width: parent.width
height: parent.width
radius: parent.width / 2
color: "transparent"
border.color: "#4caf50"
border.width: 4
visible: statusIndicator
}
2018-02-23 14:39:14 +00:00
}
}