Reach out to the contentItem inside of the ListView to find the width
authorKevin Ottens <kevin.ottens@nextcloud.com>
Mon, 6 Jul 2020 12:44:23 +0000 (14:44 +0200)
committerMichael Schuster (Rebase PR Action) <misch7@users.noreply.github.com>
Mon, 6 Jul 2020 20:39:42 +0000 (20:39 +0000)
Turns out that the ListView embedded in the Menu (reachable via
contentItem) would create a binding loop if we're using its
childrenRect. But really we're interested in the total width for the
instantiated delegate *inside* the ListView. That's why we go one level
deeper and get the childrenRect of the inner contentItem instead.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/gui/tray/Window.qml

index aa8063460cf6d8bff41e948d521d9ba0fecb3675..18c593a5097c7a9e7bb38325f44a4b7811912cdc 100644 (file)
@@ -435,7 +435,8 @@ Window {
                     Menu {\r
                         id: appsMenu\r
                         y: (trayWindowAppsButton.y + trayWindowAppsButton.height + 2)\r
-                        width: Math.min(contentItem.childrenRect.width + 4, Style.trayWindowWidth / 2)\r
+                        readonly property Item listContentItem: contentItem.contentItem\r
+                        width: Math.min(listContentItem.childrenRect.width + 4, Style.trayWindowWidth / 2)\r
                         closePolicy: "CloseOnPressOutside"\r
 \r
                         background: Rectangle {\r