diff options
Diffstat (limited to 'desktop/Drawer.qml')
| -rw-r--r-- | desktop/Drawer.qml | 69 |
1 files changed, 48 insertions, 21 deletions
diff --git a/desktop/Drawer.qml b/desktop/Drawer.qml index 31067f8..4285506 100644 --- a/desktop/Drawer.qml +++ b/desktop/Drawer.qml @@ -153,34 +153,58 @@ Scope { NotificationList { id: notifications anchors { top: parent.top; left: parent.left; right: parent.right } - anchors.bottom: grid.top + anchors.bottom: tiles.top anchors.bottomMargin: 16 onHistory: root.history = true } - // Fixed, never scrolled. Three columns at 600px with a - // 180px minimum; tiles wrap and add rows, ceiling 3x3. - Flow { - id: grid + // At most three rows tall; more tiles scroll inside + // this box, so the notification space above never + // shrinks when a module is added. + Flickable { + id: tiles anchors { left: parent.left; right: parent.right; bottom: parent.bottom } - spacing: 10 - - Repeater { - model: root.modules - - Tile { - required property QtObject modelData - // Three columns, or fewer if the panel is - // narrower than three 180px tiles allow. - width: (grid.width - 2 * grid.spacing) / 3 - icon: modelData.icon - label: modelData.label - active: modelData.active - content: modelData.tileContent - onClicked: root.activate(modelData) + readonly property int maxRows: 3 + height: Math.min(grid.height, maxRows * 96 + (maxRows - 1) * grid.spacing) + contentHeight: grid.height + clip: true + boundsBehavior: Flickable.StopAtBounds + + Flow { + id: grid + width: tiles.width + spacing: 10 + + Repeater { + model: root.modules + + Tile { + required property QtObject modelData + // Three columns, or fewer if the panel is + // narrower than three 180px tiles allow. + width: (grid.width - 2 * grid.spacing) / 3 + icon: modelData.icon + label: modelData.label + active: modelData.active + content: modelData.tileContent + onClicked: root.activate(modelData) + } } } } + + // A thin bar in the panel margin, there only when a row + // is hidden, so the fourth row is discoverable. Outside + // the Flickable, whose clip would hide it. + Rectangle { + visible: tiles.contentHeight > tiles.height + anchors { left: tiles.right; leftMargin: 6 } + y: tiles.y + tiles.visibleArea.yPosition * tiles.height + width: 3 + height: tiles.visibleArea.heightRatio * tiles.height + radius: 1.5 + color: Qt.alpha(Theme.accent, 0.6) + } } // --- page view --- @@ -195,7 +219,10 @@ Scope { // The Page's back arrow returns to the grid. Without this // the header button is inert, since the page only emits // `back` and does not know who hosts it. - onLoaded: if (item && item.back) item.back.connect(() => root.page = "") + onLoaded: { + if (item && item.back) item.back.connect(() => root.page = ""); + if (item && item.dismiss) item.dismiss.connect(root.close); + } // The page header shows the module's tile glyph. A Binding, // not an assignment in onLoaded, so a module whose icon |
