From b82b724795f4f35401e5b8d669b6582a78cef4ac Mon Sep 17 00:00:00 2001 From: tastytea <tastytea@tastytea.de> Date: Wed, 9 Mar 2022 10:25:23 +0100 Subject: [PATCH] Show long reaction text in tooltip If the reaction text is elided, it will be shown in the tooltip. --- resources/qml/Reactions.qml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/qml/Reactions.qml b/resources/qml/Reactions.qml index 63115ec00..f79cfe736 100644 --- a/resources/qml/Reactions.qml +++ b/resources/qml/Reactions.qml @@ -33,12 +33,19 @@ Flow { implicitWidth: contentItem.childrenRect.width + contentItem.leftPadding * 2 implicitHeight: contentItem.childrenRect.height ToolTip.visible: hovered - ToolTip.text: modelData.users ToolTip.delay: Nheko.tooltipDelay onClicked: { console.debug("Picked " + modelData.key + "in response to " + reactionFlow.eventId + ". selfReactedEvent: " + modelData.selfReactedEvent); room.input.reaction(reactionFlow.eventId, modelData.key); } + Component.onCompleted: { + ToolTip.text = Qt.binding(function() { + if (textMetrics.elidedText === textMetrics.text) { + return modelData.users; + } + return modelData.displayKey + "\n" + modelData.users; + }) + } contentItem: Row { anchors.centerIn: parent -- GitLab