Set maximum height of account and app menu

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>
This commit is contained in:
Stephan Beyer 2020-07-06 20:12:58 +02:00 committed by Kevin Ottens
parent 501380a004
commit e32bd75519

View file

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