summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-05-27 03:10:02 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2023-05-27 03:10:02 +0200
commit2f1b3519d38c99ded45c1a9d9e86f5d4dd961238 (patch)
treed081cdb98c21f402d4c8079c2960722eacf786be /resources
parentWork around ICE on MSVC (diff)
downloadnheko-2f1b3519d38c99ded45c1a9d9e86f5d4dd961238.tar.xz
Render custom reactions
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/Reactions.qml18
1 files changed, 12 insertions, 6 deletions
diff --git a/resources/qml/Reactions.qml b/resources/qml/Reactions.qml
index 5b81d49c..cce8720a 100644
--- a/resources/qml/Reactions.qml
+++ b/resources/qml/Reactions.qml
@@ -26,8 +26,6 @@ Flow {
             id: reaction
 
             hoverEnabled: true
-            implicitWidth: contentItem.childrenRect.width + contentItem.leftPadding * 2
-            implicitHeight: contentItem.childrenRect.height
             ToolTip.visible: hovered
             ToolTip.delay: Nheko.tooltipDelay
             onClicked: {
@@ -42,12 +40,11 @@ Flow {
                     return modelData.displayKey + "\n" + modelData.users;
                 })
             }
+                leftPadding: textMetrics.height / 2
+                rightPadding: textMetrics.height / 2
 
             contentItem: Row {
-                anchors.centerIn: parent
-                spacing: reactionText.implicitHeight / 4
-                leftPadding: reactionText.implicitHeight / 2
-                rightPadding: reactionText.implicitHeight / 2
+                spacing: textMetrics.height / 4
 
                 TextMetrics {
                     id: textMetrics
@@ -74,6 +71,15 @@ Flow {
                     font.family: Settings.emojiFont
                     color: (reaction.hovered || modelData.selfReactedEvent !== '') ? Nheko.colors.highlightedText: Nheko.colors.text
                     maximumLineCount: 1
+                    visible: !modelData.key.startsWith("mxc://")
+                }
+                Image {
+                    anchors.verticalCenter: divider.verticalCenter
+                    height: textMetrics.height
+                    width: textMetrics.height
+                    source: modelData.key.startsWith("mxc://") ? (modelData.key.replace("mxc://", "image://MxcImage/") + "?scale") : ""
+                    visible: modelData.key.startsWith("mxc://")
+                    fillMode: Image.PreserveAspectFit
                 }
 
                 Rectangle {