2018-07-07 09:38:20 +00:00
|
|
|
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
|
|
|
|
2018-07-07 09:38:20 +00:00
|
|
|
id: item
|
|
|
|
|
2018-03-04 12:05:09 +00:00
|
|
|
Rectangle {
|
2018-07-07 09:38:20 +00:00
|
|
|
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
|
2018-07-07 09:38:20 +00:00
|
|
|
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
|
2018-07-07 09:38:20 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|