Spectral/qml/component/ImageStatus.qml

44 lines
990 B
QML
Raw Normal View History

import QtQuick 2.11
import QtQuick.Controls 2.4
2018-02-23 14:39:14 +00:00
import QtGraphicalEffects 1.0
2018-03-04 12:05:09 +00:00
Item {
2018-03-04 14:40:48 +00:00
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
id: item
2018-03-04 12:05:09 +00:00
Rectangle {
width: item.width
height: item.width
radius: item.width / 2
2018-03-04 12:05:09 +00:00
color: "white"
2018-03-04 14:40:48 +00:00
visible: opaqueBackground
2018-03-04 12:05:09 +00:00
}
Image {
id: avatar
width: item.width
height: item.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
sourceSize.width: item.width
sourceSize.height: item.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
}
}
}
}