added transitions and open/close by clicking on an item for the center menu button
This commit is contained in:
parent
a6134ca10f
commit
617e772cc1
2 changed files with 45 additions and 38 deletions
|
@ -4,7 +4,6 @@ import QtQuick.Controls
|
||||||
Drawer {
|
Drawer {
|
||||||
id: drawer
|
id: drawer
|
||||||
property bool needCloseButton: true
|
property bool needCloseButton: true
|
||||||
property bool isOpened: false
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: PageController
|
target: PageController
|
||||||
|
@ -53,16 +52,12 @@ Drawer {
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
isOpened = true
|
|
||||||
|
|
||||||
if (needCloseButton) {
|
if (needCloseButton) {
|
||||||
PageController.drawerOpen()
|
PageController.drawerOpen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosed: {
|
onClosed: {
|
||||||
isOpened = false
|
|
||||||
|
|
||||||
if (needCloseButton) {
|
if (needCloseButton) {
|
||||||
PageController.drawerClose()
|
PageController.drawerClose()
|
||||||
}
|
}
|
||||||
|
@ -72,27 +67,4 @@ Drawer {
|
||||||
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
|
PageController.updateNavigationBarColor(initialPageNavigationBarColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onPositionChanged: {
|
|
||||||
if (isOpened && (position <= 0.99 && position >= 0.95)) {
|
|
||||||
mouseArea.canceled()
|
|
||||||
drawer.close()
|
|
||||||
mouseArea.exited()
|
|
||||||
dropArea.exited()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DropArea {
|
|
||||||
id: dropArea
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: mouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
onPressed: {
|
|
||||||
isOpened = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,14 @@ PageType {
|
||||||
property string defaultServerHostName: ServersModel.defaultServerHostName
|
property string defaultServerHostName: ServersModel.defaultServerHostName
|
||||||
property string defaultContainerName: ContainersModel.defaultContainerName
|
property string defaultContainerName: ContainersModel.defaultContainerName
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
enabled: buttonContent.state === "expanded"
|
||||||
|
onClicked: {
|
||||||
|
buttonContent.state = "collapsed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.bottomMargin: buttonContent.collapsedHeight
|
anchors.bottomMargin: buttonContent.collapsedHeight
|
||||||
|
@ -59,7 +67,7 @@ PageType {
|
||||||
drag.target: buttonContent
|
drag.target: buttonContent
|
||||||
drag.axis: Drag.YAxis
|
drag.axis: Drag.YAxis
|
||||||
drag.maximumY: root.height - buttonContent.collapsedHeight
|
drag.maximumY: root.height - buttonContent.collapsedHeight
|
||||||
drag.minimumY: 100
|
drag.minimumY: root.height - root.height * 0.9
|
||||||
|
|
||||||
onReleased: {
|
onReleased: {
|
||||||
if (buttonContent.state === "collapsed" && buttonContent.y < dragArea.drag.maximumY) {
|
if (buttonContent.state === "collapsed" && buttonContent.y < dragArea.drag.maximumY) {
|
||||||
|
@ -71,6 +79,12 @@ PageType {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (buttonContent.state === "collapsed") {
|
||||||
|
buttonContent.state = "expanded"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -148,7 +162,29 @@ PageType {
|
||||||
y: dragArea.drag.minimumY
|
y: dragArea.drag.minimumY
|
||||||
|
|
||||||
}
|
}
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
transitions: [
|
||||||
|
Transition {
|
||||||
|
from: "collapsed"
|
||||||
|
to: "expanded"
|
||||||
|
PropertyAnimation {
|
||||||
|
target: buttonContent
|
||||||
|
properties: "y"
|
||||||
|
duration: 200
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Transition {
|
||||||
|
from: "expanded"
|
||||||
|
to: "collapsed"
|
||||||
|
PropertyAnimation {
|
||||||
|
target: buttonContent
|
||||||
|
properties: "y"
|
||||||
|
duration: 200
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.topMargin: 24
|
Layout.topMargin: 24
|
||||||
|
@ -309,7 +345,7 @@ PageType {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 16
|
Layout.topMargin: 16
|
||||||
contentHeight: col.implicitHeight
|
contentHeight: col.implicitHeight
|
||||||
height: 500
|
implicitHeight: root.height - (root.height * 0.1) - serversMenuHeader.implicitHeight - 52 //todo 52 is tabbar height
|
||||||
visible: buttonContent.expandedVisibility
|
visible: buttonContent.expandedVisibility
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
|
@ -333,7 +369,6 @@ PageType {
|
||||||
id: serversRadioButtonGroup
|
id: serversRadioButtonGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: serversMenuContent
|
id: serversMenuContent
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue