added close button when drawer shown in the topright corner

This commit is contained in:
ronoaer 2023-09-16 08:05:43 +08:00
parent c0aca97083
commit 8a3bdf136b
7 changed files with 124 additions and 0 deletions

View file

@ -2,6 +2,16 @@ import QtQuick
import QtQuick.Controls
Drawer {
property bool needCloseButton: true
Connections {
target: PageController
function onForceCloseDrawer() {
visible = false
}
}
edge: Qt.BottomEdge
clip: true
@ -40,7 +50,18 @@ Drawer {
}
}
onOpened: {
if (needCloseButton) {
PageController.drawerOpen()
}
}
onClosed: {
if (needCloseButton) {
PageController.drawerClose()
}
var initialPageNavigationBarColor = PageController.getInitialPageNavigationBarColor()
if (initialPageNavigationBarColor !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(initialPageNavigationBarColor)

View file

@ -0,0 +1,35 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Shapes
Popup {
id: root
modal: false
closePolicy: Popup.NoAutoClose
width: 40
height: 40
padding: 4
visible: false
Overlay.modal: Rectangle {
color: Qt.rgba(14/255, 14/255, 17/255, 0.8)
}
background: Rectangle {
color: "transparent"
}
ImageButtonType {
image: "qrc:/images/svg/close_black_24dp.svg"
imageColor: "#D7D8DB"
implicitWidth: 32
implicitHeight: 32
onClicked: {
PageController.goToDrawerRootPage()
}
}
}