Add maximum width to user name in profile

Layout is: padding | text | margin | button | padding
Therefore we subtract 2x padding, 1x margin and 1x button from
width. And an extra button for some reason. 🤷
This commit is contained in:
tastytea 2022-02-05 00:45:14 +01:00
parent 2815ad0408
commit 721c315be2
No known key found for this signature in database
1 changed files with 4 additions and 0 deletions

View File

@ -138,6 +138,9 @@ ApplicationWindow {
color: TimelineManager.userColor(profile.userid, Nheko.colors.window) color: TimelineManager.userColor(profile.userid, Nheko.colors.window)
font.bold: true font.bold: true
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: parent.width - (Nheko.paddingSmall * 2) - usernameChangeButton.anchors.leftMargin - (usernameChangeButton.width * 2)
horizontalAlignment: TextInput.AlignHCenter
wrapMode: TextInput.Wrap
selectByMouse: true selectByMouse: true
onAccepted: { onAccepted: {
profile.changeUsername(displayUsername.text); profile.changeUsername(displayUsername.text);
@ -145,6 +148,7 @@ ApplicationWindow {
} }
ImageButton { ImageButton {
id: usernameChangeButton
visible: profile.isSelf visible: profile.isSelf
anchors.leftMargin: Nheko.paddingSmall anchors.leftMargin: Nheko.paddingSmall
anchors.left: displayUsername.right anchors.left: displayUsername.right