From 9b2b4b4bd19b96aedd5329b12192764f9ce3671d Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Wed, 12 Nov 2025 08:38:30 -0500 Subject: [PATCH] TrayDrawer: proper auto sizing when elements are added or removed. --- Modules/Panels/Tray/TrayDrawerPanel.qml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/Panels/Tray/TrayDrawerPanel.qml b/Modules/Panels/Tray/TrayDrawerPanel.qml index ae1376a9..ffc9bb8d 100644 --- a/Modules/Panels/Tray/TrayDrawerPanel.qml +++ b/Modules/Panels/Tray/TrayDrawerPanel.qml @@ -74,7 +74,7 @@ SmartPanel { readonly property int columns: Math.max(1, Math.min(maxColumns, itemCount)) readonly property int rows: Math.max(1, Math.ceil(itemCount / Math.max(1, columns))) - // Add 2*gap margins around the grid + // Static fallback sizes preferredWidth: (columns * cellSize) + ((columns - 1) * innerSpacing) + (2 * outerPadding) preferredHeight: (rows * cellSize) + ((rows - 1) * innerSpacing) + (2 * outerPadding) @@ -120,6 +120,10 @@ SmartPanel { panelContent: Item { id: content + // Dynamic content sizing that SmartPanel will watch for changes + property real contentPreferredWidth: (root.columns * root.cellSize) + ((root.columns - 1) * root.innerSpacing) + (2 * root.outerPadding) + property real contentPreferredHeight: (root.rows * root.cellSize) + ((root.rows - 1) * root.innerSpacing) + (2 * root.outerPadding) + Grid { id: grid anchors.fill: parent