mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 09:30:47 +03:00
Fix username label eliding loop
This commit is contained in:
parent
d2c616ee67
commit
b1c2b384c6
2 changed files with 11 additions and 5 deletions
|
@ -572,17 +572,23 @@ Item {
|
||||||
rightInset: 0
|
rightInset: 0
|
||||||
rightPadding: 0
|
rightPadding: 0
|
||||||
|
|
||||||
contentItem: ElidedLabel {
|
contentItem: Label {
|
||||||
id: userName_
|
id: userName_
|
||||||
|
|
||||||
color: TimelineManager.userColor(userId, palette.base)
|
color: TimelineManager.userColor(userId, palette.base)
|
||||||
elideWidth: Math.min(userInfo.remainingWidth - Math.min(statusMsg.implicitWidth, userInfo.remainingWidth / 3), userName_.fullTextWidth)
|
text: TimelineManager.escapeEmoji(userNameTextMetrics.elidedText)
|
||||||
fullText: userName
|
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: room.openUserProfile(userId)
|
onClicked: room.openUserProfile(userId)
|
||||||
|
|
||||||
|
TextMetrics {
|
||||||
|
id: userNameTextMetrics
|
||||||
|
|
||||||
|
elide: Text.ElideRight
|
||||||
|
elideWidth: userInfo.remainingWidth - Math.min(statusMsg.implicitWidth, userInfo.remainingWidth / 3)
|
||||||
|
text: userName
|
||||||
|
}
|
||||||
CursorShape {
|
CursorShape {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
|
@ -91,7 +91,7 @@ ApplicationWindow {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
ElidedLabel {
|
ElidedLabel {
|
||||||
text: model.displayName
|
fullText: model.displayName
|
||||||
color: TimelineManager.userColor(model ? model.mxid : "", palette.window)
|
color: TimelineManager.userColor(model ? model.mxid : "", palette.window)
|
||||||
font.pointSize: fontMetrics.font.pointSize
|
font.pointSize: fontMetrics.font.pointSize
|
||||||
elideWidth: del.width - Nheko.paddingMedium - avatar.width
|
elideWidth: del.width - Nheko.paddingMedium - avatar.width
|
||||||
|
@ -99,7 +99,7 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
ElidedLabel {
|
ElidedLabel {
|
||||||
text: model.timestamp
|
fullText: model.timestamp
|
||||||
color: palette.buttonText
|
color: palette.buttonText
|
||||||
font.pointSize: fontMetrics.font.pointSize * 0.9
|
font.pointSize: fontMetrics.font.pointSize * 0.9
|
||||||
elideWidth: del.width - Nheko.paddingMedium - avatar.width
|
elideWidth: del.width - Nheko.paddingMedium - avatar.width
|
||||||
|
|
Loading…
Reference in a new issue