fix(ProfileHeader): don't overflow the title

- calculate the text width correctly, taking into account all the
contents (verifications icons, edit button) and also the margins

Fixes #14462
This commit is contained in:
Lukáš Tinkl 2024-04-19 00:12:29 +02:00 committed by Lukáš Tinkl
parent 38d6b694fb
commit 78acdca225
1 changed files with 4 additions and 2 deletions

View File

@ -200,7 +200,8 @@ Item {
StyledText { StyledText {
objectName: "ProfileHeader_displayName" objectName: "ProfileHeader_displayName"
Layout.maximumWidth: root.width - Style.current.xlPadding Layout.maximumWidth: root.width - verificationIcons.width - contentContainer.anchors.leftMargin - contentContainer.anchors.rightMargin -
(editButtonLoader.active ? editButtonLoader.item.width : 0)
text: root.displayName text: root.displayName
elide: Text.ElideRight elide: Text.ElideRight
font { font {
@ -210,7 +211,7 @@ Item {
} }
StatusContactVerificationIcons { StatusContactVerificationIcons {
Layout.alignment: Qt.AlignVCenter id: verificationIcons
visible: !root.isCurrentUser && !root.isBridgedAccount visible: !root.isCurrentUser && !root.isBridgedAccount
isContact: root.isContact isContact: root.isContact
trustIndicator: root.trustStatus trustIndicator: root.trustStatus
@ -218,6 +219,7 @@ Item {
} }
Loader { Loader {
id: editButtonLoader
sourceComponent: SVGImage { sourceComponent: SVGImage {
objectName: "ProfileHeader_displayNameEditIcon" objectName: "ProfileHeader_displayNameEditIcon"
height: compact ? 10 : 16 height: compact ? 10 : 16