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
This commit is contained in:
Karthik Nishanth 2023-08-23 23:39:15 -07:00 committed by Aleix Pol Gonzalez
parent f42bb35346
commit 9e53696e35

View file

@ -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 {