summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarcus Hoffmann <bubu@bubu1.eu>2023-02-16 23:18:41 +0100
committerMarcus Hoffmann <bubu@bubu1.eu>2023-02-21 12:39:43 +0100
commit9c5a7c407598ac67d41426140610dcfff3b0c33a (patch)
tree205433e37285f51d3114243c39a18e7f5ab8ba8d
parentMessageView: improve styling of presence status (diff)
downloadnheko-9c5a7c407598ac67d41426140610dcfff3b0c33a.tar.xz
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 <bubu@bubu1.eu>
-rw-r--r--resources/qml/MessageView.qml11
1 files 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