Move autoexpand from MultiViewPane to base HDrawer

This commit is contained in:
miruka 2020-07-14 03:19:57 -04:00
parent 4b7ce1a195
commit f84b13c657
3 changed files with 10 additions and 11 deletions

View File

@ -15,11 +15,12 @@ Drawer {
property alias color: bg.color property alias color: bg.color
property int defaultSize: 300 * theme.uiScale property int defaultSize: 300 * theme.uiScale
property bool requireDefaultSize: false
property int preferredSize: property int preferredSize:
window.getState(this, "preferredSize", defaultSize) window.getState(this, "preferredSize", defaultSize)
property int minimumSize: resizeAreaSize property int minimumSize: requireDefaultSize ? defaultSize : resizeAreaSize
property int maximumSize: property int maximumSize:
horizontal ? referenceSizeParent.width : referenceSizeParent.height horizontal ? referenceSizeParent.width : referenceSizeParent.height
@ -87,6 +88,13 @@ Drawer {
NumberAnimation { duration: 100 } NumberAnimation { duration: 100 }
} }
Behavior on minimumSize {
HNumberAnimation {
overshoot: requireDefaultSize ? 1 : 4
factor: 0.75
}
}
Item { Item {
id: resizeArea id: resizeArea
x: vertical || drawer.edge === Qt.RightEdge ? 0 : drawer.width-width x: vertical || drawer.edge === Qt.RightEdge ? 0 : drawer.width-width

View File

@ -14,8 +14,6 @@ HDrawer {
property int buttonWidth: property int buttonWidth:
buttonRepeater.count > 0 ? buttonRepeater.itemAt(0).implicitWidth : 0 buttonRepeater.count > 0 ? buttonRepeater.itemAt(0).implicitWidth : 0
property bool requireDefaultSize: false
readonly property alias buttonRepeater: buttonRepeater readonly property alias buttonRepeater: buttonRepeater
readonly property alias swipeView: swipeView readonly property alias swipeView: swipeView
@ -23,13 +21,6 @@ HDrawer {
defaultSize: buttonRepeater.count * buttonWidth defaultSize: buttonRepeater.count * buttonWidth
minimumSize: requireDefaultSize ? defaultSize : buttonWidth minimumSize: requireDefaultSize ? defaultSize : buttonWidth
Behavior on minimumSize {
HNumberAnimation {
overshoot: requireDefaultSize ? 1 : 4
factor: 0.75
}
}
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: theme.mainPane.minimumSize minimumSize: requireDefaultSize ? defaultSize : theme.mainPane.minimumSize
Behavior on opacity { HNumberAnimation {} } Behavior on opacity { HNumberAnimation {} }