Add HDrawer.calculatedMinimumSize property

This commit is contained in:
miruka 2020-07-14 15:55:19 -04:00
parent efda3a419e
commit e76143c172
3 changed files with 8 additions and 5 deletions

View File

@ -20,7 +20,7 @@ Drawer {
property int preferredSize: property int preferredSize:
window.getState(this, "preferredSize", defaultSize) window.getState(this, "preferredSize", defaultSize)
property int minimumSize: requireDefaultSize ? defaultSize : resizeAreaSize property int minimumSize: resizeAreaSize
property int maximumSize: property int maximumSize:
horizontal ? referenceSizeParent.width : referenceSizeParent.height horizontal ? referenceSizeParent.width : referenceSizeParent.height
@ -40,10 +40,13 @@ Drawer {
property int resizeAreaSize: theme.spacing / 2 property int resizeAreaSize: theme.spacing / 2
property int calculatedMinimumSize:
requireDefaultSize ? defaultSize : minimumSize
readonly property int calculatedSize: readonly property int calculatedSize:
collapse ? collapse ?
peekSizeWhileCollapsed : peekSizeWhileCollapsed :
Math.max(minimumSize, Math.min(preferredSize, maximumSize)) Math.max(calculatedMinimumSize, Math.min(preferredSize, maximumSize))
// //
@ -88,7 +91,7 @@ Drawer {
NumberAnimation { duration: 100 } NumberAnimation { duration: 100 }
} }
Behavior on minimumSize { HNumberAnimation { factor: 0.75 } } Behavior on calculatedMinimumSize { HNumberAnimation { factor: 0.75 } }
Item { Item {
id: resizeArea id: resizeArea

View File

@ -19,7 +19,7 @@ HDrawer {
defaultSize: buttonRepeater.count * buttonWidth defaultSize: buttonRepeater.count * buttonWidth
minimumSize: requireDefaultSize ? defaultSize : buttonWidth minimumSize: buttonWidth
HColumnLayout { HColumnLayout {
anchors.fill: parent anchors.fill: parent

View File

@ -24,7 +24,7 @@ HDrawer {
saveName: "mainPane" saveName: "mainPane"
background: Rectangle { color: theme.mainPane.background } background: Rectangle { color: theme.mainPane.background }
minimumSize: requireDefaultSize ? defaultSize : theme.mainPane.minimumSize minimumSize: theme.mainPane.minimumSize
requireDefaultSize: bottomBar.filterField.activeFocus requireDefaultSize: bottomBar.filterField.activeFocus
Behavior on opacity { HNumberAnimation {} } Behavior on opacity { HNumberAnimation {} }