Change width of app menu
authorStephan Beyer <s-beyer@gmx.net>
Sat, 6 Jun 2020 21:55:31 +0000 (23:55 +0200)
committerKevin Ottens <ervin@ipsquad.net>
Tue, 9 Jun 2020 12:53:51 +0000 (14:53 +0200)
The app menu had a width based on the header button size which was
way too narrow to display its content.

This commit changes the width based on the contents (menu items) of
the menu, however, limiting the maximum width to half the window width.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
src/gui/tray/Window.qml

index d8fa79dc4aef6b309eeed791bdee2b93c505e6a2..3f23cad56f80e6a9fe8cfd9f1d7652bbf89963a1 100644 (file)
@@ -459,7 +459,7 @@ Window {
                         Menu {\r
                             id: appsMenu\r
                             y: (trayWindowAppsButton.y + trayWindowAppsButton.height + 2)\r
-                            width: (Style.headerButtonIconSize * 3)\r
+                            width: Math.min(contentItem.childrenRect.width + 4, Style.trayWindowWidth / 2)\r
                             closePolicy: "CloseOnPressOutside"\r
 \r
                             background: Rectangle {\r
@@ -476,6 +476,7 @@ Window {
                                     text: appName\r
                                     font.pixelSize: Style.topLinePixelSize\r
                                     icon.source: appIconUrl\r
+                                    width: contentItem.implicitWidth + leftPadding + rightPadding\r
                                     onTriggered: appsMenuModelBackend.openAppUrl(appUrl)\r
                                 }\r
                             }\r