Merge pull request #328 from amnezia-vpn/bugfix/add_top_close_button

added close button when drawer shown in the topright corner
This commit is contained in:
Nethius 2023-09-18 10:48:13 +05:00 committed by GitHub
commit 814c574f26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 118 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
@ -38,6 +48,16 @@ Drawer {
if (PageController.getInitialPageNavigationBarColor() !== 0xFF1C1D21) {
PageController.updateNavigationBarColor(0xFF1C1D21)
}
if (needCloseButton) {
PageController.drawerOpen()
}
}
onAboutToHide: {
if (needCloseButton) {
PageController.drawerClose()
}
}
onClosed: {

View file

@ -0,0 +1,30 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Shapes
Popup {
id: root
modal: false
closePolicy: Popup.NoAutoClose
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"
onClicked: {
PageController.goToDrawerRootPage()
}
}
}