Set maximum height of account and app menu
authorStephan Beyer <s-beyer@gmx.net>
Mon, 6 Jul 2020 18:12:58 +0000 (20:12 +0200)
committerKevin Ottens <ervin@ipsquad.net>
Tue, 7 Jul 2020 15:35:09 +0000 (17:35 +0200)
The menus may become too large if they have too many items
(the account menu has this in case of many accounts, the apps
menu in case of many apps).  This commit limits the maximum
height such that the menus do not hide the header.

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

index 18c593a5097c7a9e7bb38325f44a4b7811912cdc..1efb8212ba61f01a17933c3787e0b13a948cfb21 100644 (file)
@@ -19,6 +19,8 @@ Window {
     color:      "transparent"\r
     flags:      Qt.Dialog | Qt.FramelessWindowHint\r
 \r
+    readonly property int maxMenuHeight: Style.trayWindowHeight - Style.trayWindowHeaderHeight - 2 * Style.trayWindowBorderWidth\r
+\r
     // Close tray window when focus is lost (e.g. click somewhere else on the screen)\r
     onActiveChanged: {\r
         if(!active) {\r
@@ -145,6 +147,7 @@ Window {
                             y: (currentAccountButton.y + Style.trayWindowHeaderHeight + 2)\r
 \r
                             width: (Style.currentAccountButtonWidth - 2)\r
+                            height: Math.min(implicitHeight, maxMenuHeight)\r
                             closePolicy: "CloseOnPressOutside"\r
 \r
                             background: Rectangle {\r
@@ -437,6 +440,7 @@ Window {
                         y: (trayWindowAppsButton.y + trayWindowAppsButton.height + 2)\r
                         readonly property Item listContentItem: contentItem.contentItem\r
                         width: Math.min(listContentItem.childrenRect.width + 4, Style.trayWindowWidth / 2)\r
+                        height: Math.min(implicitHeight, maxMenuHeight)\r
                         closePolicy: "CloseOnPressOutside"\r
 \r
                         background: Rectangle {\r