fix: accounts menu width adapting to it's contents

Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
This commit is contained in:
Tamás Bari 2025-10-15 11:08:36 +02:00 committed by Jyrki Gadinger
parent adaa54cced
commit 8145c1ef7a
2 changed files with 13 additions and 2 deletions

View File

@ -53,7 +53,8 @@ Button {
x: (root.x + 2)
y: (root.y + Style.trayWindowHeaderHeight + 2)
width: (Style.rootWidth - 2)
property real widestMenuItemWidth: 0
width: widestMenuItemWidth + leftPadding + rightPadding
height: Math.min(implicitHeight, maxMenuHeight)
closePolicy: Menu.CloseOnPressOutsideParent | Menu.CloseOnEscape
@ -71,7 +72,12 @@ Button {
implicitHeight: instantiatedUserLine.height
UserLine {
id: instantiatedUserLine
width: parent.width
width: accountMenu.widestMenuItemWidth
Component.onCompleted: {
accountMenu.widestMenuItemWidth = Math.max( instantiatedUserLine.implicitWidth, accountMenu.widestMenuItemWidth )
}
onShowUserStatusSelector: {
userStatusDrawer.openUserStatusDrawer(model.index);
accountMenu.close();

View File

@ -27,6 +27,7 @@ AbstractButton {
contentItem: RowLayout {
id: userLineLayout
spacing: Style.userLineSpacing
width: parent.width
Image {
id: accountAvatar
@ -139,6 +140,10 @@ AbstractButton {
}
}
Item { // Spacer
Layout.fillWidth: true
}
Button {
id: userMoreButton
Layout.preferredWidth: Style.headerButtonIconSize