TrayDrawer: proper auto sizing when elements are added or removed.

This commit is contained in:
ItsLemmy
2025-11-12 08:38:30 -05:00
parent 875aca2a36
commit 9b2b4b4bd1
+5 -1
View File
@@ -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