fix position of reactions in timeline

This commit is contained in:
Carl Schwan
2020-11-08 14:45:17 +01:00
parent 485dd64941
commit e96dab7161
3 changed files with 41 additions and 34 deletions

View File

@@ -120,15 +120,6 @@ RowLayout {
} }
} }
} }
ReactionDelegate {
Layout.fillWidth: true
Layout.topMargin: 0
Layout.bottomMargin: 8
Layout.leftMargin: 16
Layout.rightMargin: 16
}
} }
} }
} }

View File

@@ -18,15 +18,15 @@ Flow {
model: reaction model: reaction
delegate: Control { delegate: Control {
width: Math.min(implicitWidth, 128) width: Math.max(implicitWidth, Kirigami.Units.largeSpacing * 3)
height: width height: Kirigami.Units.largeSpacing * 3
horizontalPadding: 6 horizontalPadding: 6
verticalPadding: 0 verticalPadding: 0
contentItem: Label { contentItem: Label {
height: Kirigami.Units.largeSpacing * 3
text: modelData.reaction + (modelData.count > 1 ? " " + modelData.count : "") text: modelData.reaction + (modelData.count > 1 ? " " + modelData.count : "")
font.pixelSize: 14
font.family: "emoji" font.family: "emoji"
elide: Text.ElideRight elide: Text.ElideRight
} }
@@ -41,9 +41,10 @@ Flow {
hoverEnabled: true hoverEnabled: true
ToolTip.visible: containsMouse ToolTip {
TootTip.font.family: Kirigami.Theme.defaultFont.family + ", emoji" visible: parent.containsMouse
ToolTip.text: { font.family: Kirigami.Theme.defaultFont.family + ", emoji"
text: {
var text = ""; var text = "";
for (var i = 0; i < modelData.authors.length; i++) { for (var i = 0; i < modelData.authors.length; i++) {
@@ -60,6 +61,7 @@ Flow {
return text return text
} }
}
onClicked: currentRoom.toggleReaction(eventId, modelData.reaction) onClicked: currentRoom.toggleReaction(eventId, modelData.reaction)
} }

View File

@@ -192,9 +192,16 @@ Kirigami.ScrollablePage {
anchors.fill: parent anchors.fill: parent
onClicked: openMessageContext(author, display, eventId, toolTip); onClicked: openMessageContext(author, display, eventId, toolTip);
} }
innerObject: TextDelegate { innerObject: [
TextDelegate {
Layout.fillWidth: true Layout.fillWidth: true
},
ReactionDelegate {
Layout.fillWidth: true
Layout.topMargin: 0
Layout.bottomMargin: 8
} }
]
} }
} }
} }
@@ -222,11 +229,18 @@ Kirigami.ScrollablePage {
innerObject: MessageDelegate { innerObject: MessageDelegate {
Layout.fillWidth: true Layout.fillWidth: true
innerObject: ImageDelegate { innerObject: [
ImageDelegate {
Layout.maximumWidth: parent.width Layout.maximumWidth: parent.width
Layout.preferredWidth: Math.min(320, info.w) Layout.preferredWidth: Math.min(320, info.w)
Layout.preferredHeight: Math.min(320, info.h) Layout.preferredHeight: Math.min(320, info.h)
},
ReactionDelegate {
Layout.fillWidth: true
Layout.topMargin: 0
Layout.bottomMargin: 8
} }
]
} }
} }
} }