From 5452c51c6adbb362ff7f49f37d5a3d5358ae3eab Mon Sep 17 00:00:00 2001 From: James Graham Date: Mon, 12 May 2025 19:00:29 +0100 Subject: [PATCH] Elide the user ID in UserDetailDialog if it's too long Elide the user ID in UserDetailDialog if it's too long BUG: 501483 --- src/app/qml/UserDetailDialog.qml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/app/qml/UserDetailDialog.qml b/src/app/qml/UserDetailDialog.qml index 3caab77fd..55a424cad 100644 --- a/src/app/qml/UserDetailDialog.qml +++ b/src/app/qml/UserDetailDialog.qml @@ -36,6 +36,7 @@ Kirigami.Dialog { contentItem: ColumnLayout { spacing: 0 RowLayout { + id: detailRow Layout.fillWidth: true Layout.leftMargin: Kirigami.Units.largeSpacing Layout.rightMargin: Kirigami.Units.largeSpacing @@ -70,8 +71,17 @@ Kirigami.Dialog { } Kirigami.SelectableLabel { + id: idLabel textFormat: TextEdit.PlainText - text: root.user.id + text: idLabelTextMetrics.elidedText + + TextMetrics { + id: idLabelTextMetrics + text: root.user.id + elide: Qt.ElideRight + elideWidth: root.availableWidth - avatar.width - qrButton.width - detailRow.spacing * 2 - detailRow.Layout.leftMargin - detailRow.Layout.rightMargin + onElideWidthChanged: console.warn(root.availableWidth, avatar.width, qrButton.width, elideWidth, elidedText) + } } QQC2.Label { @@ -88,6 +98,7 @@ Kirigami.Dialog { } } QQC2.AbstractButton { + id: qrButton Layout.minimumHeight: avatar.height * 0.75 Layout.maximumHeight: avatar.height * 1.5 Layout.maximumWidth: avatar.height * 1.5