Simplify reaction delegate

This commit is contained in:
Carl Schwan
2020-11-23 19:58:07 +01:00
parent 17ceb59a71
commit 20966806d2

View File

@@ -17,32 +17,23 @@ Flow {
Repeater {
model: reaction
delegate: Control {
width: Math.max(implicitWidth, Kirigami.Units.largeSpacing * 3)
height: Kirigami.Units.largeSpacing * 3
delegate: RoundButton {
width: Math.min(implicitWidth, Kirigami.Units.largeSpacing * 4)
implicitHeight: Kirigami.Units.largeSpacing * 4
horizontalPadding: 6
verticalPadding: 0
contentItem: Label {
height: Kirigami.Units.largeSpacing * 3
text: modelData.reaction + (modelData.count > 1 ? " " + modelData.count : "")
elide: Text.ElideRight
}
background: Rectangle {
radius: height / 2
Kirigami.Theme.colorSet: Kirigami.Theme.Window
color: Kirigami.Theme.backgroundColor
checkable: true
MouseArea {
anchors.fill: parent
checked: modelData.hasLocalUser
hoverEnabled: true
onToggled: currentRoom.toggleReaction(eventId, modelData.reaction)
ToolTip {
visible: parent.containsMouse
text: {
ToolTip.visible: hovered
ToolTip.text: {
var text = "";
for (var i = 0; i < modelData.authors.length; i++) {
@@ -60,11 +51,6 @@ Flow {
return text
}
}
onClicked: currentRoom.toggleReaction(eventId, modelData.reaction)
}
}
}
}
}