Commit 70a3c834 authored by Claudio Cambra's avatar Claudio Cambra
Browse files

Fix bugs, errors, and crashes with the sidebar

parent 8642ac3c
Pipeline #129125 passed with stage
in 5 minutes and 6 seconds
......@@ -49,12 +49,12 @@ Item {
//Internal
property int numberOfLinesShown: 0
property int numberOfRows: (daysToShow / daysPerRow)
property double dayWidth: Kalendar.Config.showWeekNumbers ?
property int dayWidth: Kalendar.Config.showWeekNumbers ?
((width - weekHeaderWidth) / daysPerRow) - spacing : // No spacing on right, spacing in between weekheader and monthgrid
(width - weekHeaderWidth - (spacing * (daysPerRow - 1))) / daysPerRow // No spacing on left or right of month grid when no week header
property var dayHeight: ((height - bgLoader.dayLabels.height) / numberOfRows) - spacing
property real spacing: Kalendar.Config.monthGridBorderWidth // Between grid squares in background
property real listViewSpacing: root.dayWidth < (Kirigami.Units.gridUnit * 5 + Kirigami.Units.smallSpacing * 2) ?
property int dayHeight: ((height - bgLoader.dayLabels.height) / numberOfRows) - spacing
property int spacing: Kalendar.Config.monthGridBorderWidth // Between grid squares in background
property int listViewSpacing: root.dayWidth < (Kirigami.Units.gridUnit * 5 + Kirigami.Units.smallSpacing * 2) ?
Kirigami.Units.smallSpacing / 2 : Kirigami.Units.smallSpacing // Between lines of incidences ( ====== <- )
readonly property bool isDark: LabelUtils.isDarkColor(Kirigami.Theme.backgroundColor)
......
......@@ -43,20 +43,13 @@ Kirigami.OverlayDrawer {
}
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.
// Changing the modality automatically opens the drawer, so making the sidebar collapsed opens the
// drawer. This is more intuitive than having two buttons each of which handle different aspects of
// the drawer.
collapsed: Config.forceCollapsedSidebar
modal: Kirigami.Settings.isMobile
handleVisible: modal
handleClosedIcon.source: null
handleOpenIcon.source: null
drawerOpen: !Kirigami.Settings.isMobile
// We want the modal drawer to close into a collapsed non-modal drawer, not to close the drawer altogether.
// Otherwise the collapsed drawer would not be visible (and without the handle we'd have no way to open it).
// We also have to re-notify because of some dumb glitch, idk.
onDrawerOpenChanged: if(!Kirigami.Settings.isMobile && modal) collapsed = true, drawerOpen = true, collapsedChanged()
width: sidebar.collapsed ? menu.Layout.minimumWidth + Kirigami.Units.smallSpacing : Kirigami.Units.gridUnit * 16
Component.onCompleted: collapsed = Config.forceCollapsedSidebar // Fix crashing caused by setting on load
Behavior on width { NumberAnimation { duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad } }
Kirigami.Theme.colorSet: Kirigami.Theme.Window
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment