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:
commit
814c574f26
7 changed files with 118 additions and 0 deletions
|
|
@ -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: {
|
||||
|
|
|
|||
30
client/ui/qml/Controls2/TopCloseButtonType.qml
Normal file
30
client/ui/qml/Controls2/TopCloseButtonType.qml
Normal 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()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue