Save/load sidePane manually-set width

This commit is contained in:
miruka 2019-07-21 09:08:22 -04:00
parent c0b51b574c
commit daa2c36af1
2 changed files with 16 additions and 3 deletions

View File

@ -101,4 +101,5 @@ class UIState(JSONConfigFile):
return {
"page": "Pages/Default.qml",
"pageProperties": {},
"sidePaneManualWidth": None,
}

View File

@ -16,6 +16,18 @@ HRectangle {
property bool manuallyResized: false
property int manualWidth: 0
Component.onCompleted: {
if (window.uiState.sidePaneManualWidth) {
manualWidth = window.uiState.sidePaneManualWidth
manuallyResized = true
}
}
onManualWidthChanged: {
window.uiState.sidePaneManualWidth = manualWidth
window.uiStateChanged()
}
property int maximumCalculatedWidth: Math.min(
manuallyResized ? manualWidth : theme.sidePane.maximumAutoWidth,
window.width - theme.minimumSupportedWidthPlusSpacing
@ -27,7 +39,7 @@ HRectangle {
property int calculatedWidth: Math.min(
manuallyResized ? manualWidth: parentWidth * autoWidthRatio,
manuallyResized ? manualWidth : parentWidth * autoWidthRatio,
maximumCalculatedWidth
)