Add sidePane settings to theme

This commit is contained in:
miruka
2019-07-16 08:36:11 -04:00
parent 5cc701113e
commit 522b689ce7
3 changed files with 26 additions and 11 deletions

View File

@@ -39,29 +39,33 @@ Item {
SidePane {
id: sidePane
visible: accountsPresent
collapsed: width < Layout.minimumWidth + theme.spacing
property int parentWidth: parent.width
property int collapseBelow: 120
property QtObject ts: theme.sidePane
function set_width() {
width = parent.width * 0.3 < collapseBelow ?
Layout.minimumWidth : Math.min(parent.width * 0.3, 300)
width =
parent.width * ts.autoWidthRatio <
ts.autoCollapseBelowWidth ?
Layout.minimumWidth :
Math.min(parent.width * ts.autoWidthRatio,
ts.maximumAutoWidth)
}
property int parentWidth: parent.width
onParentWidthChanged: if (uiSplitView.canAutoSize) { set_width() }
width: set_width() // Initial width
Layout.minimumWidth: theme.avatar.size
Layout.minimumWidth: ts.collapsedWidth
Layout.maximumWidth: parent.width
Behavior on width {
HNumberAnimation {
// Don't slow down the user manually resizing
duration:
(uiSplitView.canAutoSize &&
parent.width * 0.3 < sidePane.collapseBelow * 1.2) ?
theme.animationDuration : 0
duration: (
uiSplitView.canAutoSize &&
parent.width * 0.3 <
theme.sidePane.autoReduceBelowWidth * 1.2
) ? theme.animationDuration : 0
}
}
}