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>
This commit is contained in:
Marcus Hoffmann 2023-02-16 23:18:41 +01:00
parent 6c37f219ba
commit 9c5a7c4075

View file

@ -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