-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathReactionImage.qml
51 lines (42 loc) · 1.26 KB
/
ReactionImage.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
51
import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
ColumnLayout {
property string reaction
property bool selected: false
property int size: 40
Layout.minimumWidth: (size >= 60) ? size - 20: 40
Layout.preferredWidth: (size >= 60) ? size: 60
Layout.minimumHeight: 80
Rectangle {
Layout.preferredWidth: size
Layout.preferredHeight: size
color: rdio.checked ? "green": "transparent"
Image {
width: parent.width
height: parent.height
fillMode: Image.PreserveAspectFit
source: "reactions/" + reaction + ".png"
MouseArea {
id: ma
hoverEnabled: true
anchors.fill: parent
cursorShape: ma.containsMouse ? Qt.PointingHandCursor: Qt.ArrowCursor
onClicked: {
reactionGroup.current = rdio
}
}
}
}
Rectangle {
Layout.preferredWidth: size
Layout.preferredHeight: size/2
RadioButton {
id: rdio
anchors.horizontalCenter: parent.horizontalCenter
text: reaction
checked: selected
exclusiveGroup: reactionGroup
}
}
}