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