used position-changed to closes drawer
This commit is contained in:
parent
893ec2d61c
commit
dd039a612f
1 changed files with 23 additions and 5 deletions
|
|
@ -4,6 +4,7 @@ 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
|
||||||
|
|
@ -61,22 +62,39 @@ Drawer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onOpened: {
|
||||||
|
isOpened = true
|
||||||
|
}
|
||||||
|
|
||||||
onClosed: {
|
onClosed: {
|
||||||
|
isOpened = false
|
||||||
|
|
||||||
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
|
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
|
||||||
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
|
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
|
||||||
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 {
|
MouseArea {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
onCanceled: {
|
onPressed: {
|
||||||
Drag.cancel()
|
isOpened = true
|
||||||
drawer.close()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
preventStealing: false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue