From a42335aed2cc44591fa836a0911eaef07e345250 Mon Sep 17 00:00:00 2001 From: Malte E <97891689+maltee1@users.noreply.github.com> Date: Sun, 20 Mar 2022 05:12:41 +0100 Subject: elide usernames in timeline (#997) * Use advanceWidth to get the with of the original text Co-authored-by: Nicolas Werner --- resources/qml/delegates/Reply.qml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'resources/qml/delegates') diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml index f5756390..513b7c0b 100644 --- a/resources/qml/delegates/Reply.qml +++ b/resources/qml/delegates/Reply.qml @@ -9,6 +9,7 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.2 import QtQuick.Window 2.13 import im.nheko 1.0 +import "../" Item { id: r @@ -39,7 +40,7 @@ Item { height: replyContainer.height implicitHeight: replyContainer.height - implicitWidth: visible? colorLine.width+replyContainer.implicitWidth : 0 + implicitWidth: visible? colorLine.width+Math.max(replyContainer.implicitWidth,userName_.fullTextWidth) : 0 // visible? seems to be causing issues CursorShape { anchors.fill: parent @@ -83,13 +84,15 @@ Item { } AbstractButton { - id: userName_ Layout.leftMargin: 4 - contentItem: Text { - - text: TimelineManager.escapeEmoji(userName) + Layout.fillWidth: true + contentItem: ElidedLabel { + id: userName_ + fullText: userName color: r.userColor textFormat: Text.RichText + width: parent.width + elideWidth: width } onClicked: room.openUserProfile(userId) } -- cgit 1.5.1