-
Notifications
You must be signed in to change notification settings - Fork 6
/
UserAvatar.qml
50 lines (45 loc) · 1.05 KB
/
UserAvatar.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import QtQuick 2.2
import QtGraphicalEffects 1.0
Item {
id: avatar
property string source: ""
signal clicked()
Image {
id: avatarImg
source: parent.source
width: parent.width
height: parent.height
fillMode: Image.PreserveAspectCrop
layer.enabled: true
layer.effect: OpacityMask {
maskSource: avatarMask
}
}
Rectangle {
id: avatarMask
width: parent.width
height: parent.height
radius: parent.width / 2
visible: false
}
Rectangle {
id: avatarBorder
width: parent.width
height: parent.height
radius: parent.width / 2
color: "#00000000"
border.width: 4
border.color: "#ffffffff"
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
avatarBorder.border.color = "#77ffffff"
}
onExited: {
avatarBorder.border.color = "#ffffffff"
}
onClicked: avatar.clicked()
}
}