From 9c5a7c407598ac67d41426140610dcfff3b0c33a Mon Sep 17 00:00:00 2001 From: Marcus Hoffmann Date: Thu, 16 Feb 2023 23:18:41 +0100 Subject: [PATCH] MessageView: Add ToolTip to status message Show the user that this is a status text on hover. We need to change the status text label width to be it's implicitWidth (or the maximum width as specified before), otherwise the tooltip is wildly off-centered. Signed-off-by: Marcus Hoffmann --- resources/qml/MessageView.qml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml index 5309fcf4..573c8344 100644 --- a/resources/qml/MessageView.qml +++ b/resources/qml/MessageView.qml @@ -379,9 +379,16 @@ Item { text: Presence.userStatus(userId) textFormat: Text.PlainText elide: Text.ElideRight - width: userInfo.remainingWidth - userName_.width - parent.spacing + width: Math.min(implicitWidth, userInfo.remainingWidth - userName_.width - parent.spacing) font.italic: true - font.pointSize: fontMetrics.font.pointSize * 0.8 + font.pointSize: Math.floor(fontMetrics.font.pointSize * 0.8) + ToolTip.text: qsTr("%1's status message").arg(userName) + ToolTip.visible: statusMsgHoverHandler.hovered + ToolTip.delay: Nheko.tooltipDelay + + HoverHandler { + id: statusMsgHoverHandler + } Connections { target: Presence