From 9e53696e35cd9061654d151480f2ba9e52d61461 Mon Sep 17 00:00:00 2001 From: Karthik Nishanth Date: Wed, 23 Aug 2023 23:39:15 -0700 Subject: [PATCH] Close the overlay drawer when window width is reduced Previously when the window width was reduced, the overlay drawer was still visible except it was hidden behind the main view. Taking inspiration from the binding in OverlayDrawer.qml source, I set up a callback to match it closely. Now, it closes the drawer when the window is resized. Note: Both before and after this commit, there is a warning when one collapses the window width. > QQuickItem::stackBefore: Cannot stack > QQuickRectangle(0x55b4746513d0, parent=0x55b4744a4750, > geometry=0,0 0x0) before QQuickPopupItem(0x55b4747871c0), > which must be a sibling --- app/qml/main.qml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/qml/main.qml b/app/qml/main.qml index 05eac8aab..94e429016 100644 --- a/app/qml/main.qml +++ b/app/qml/main.qml @@ -23,11 +23,8 @@ Kirigami.ApplicationWindow { id: drawer edge: Qt.application.layoutDirection === Qt.RightToLeft ? Qt.RightEdge : Qt.LeftEdge modal: Kirigami.Settings.isMobile || (applicationWindow().width < Kirigami.Units.gridUnit * 50 && !collapsed) // Only modal when not collapsed, otherwise collapsed won't show. - drawerOpen: !Kirigami.Settings.isMobile width: Kirigami.Units.gridUnit * 16 - onModalChanged: if (!modal) { - drawerOpen = true; - } + onModalChanged: drawerOpen = !modal Behavior on width { NumberAnimation {