added close button when drawer shown in the topright corner
This commit is contained in:
parent
c0aca97083
commit
8a3bdf136b
7 changed files with 124 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
|
||||
|
@ -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)
|
||||
|
|
35
client/ui/qml/Controls2/TopCloseButtonType.qml
Normal file
35
client/ui/qml/Controls2/TopCloseButtonType.qml
Normal 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()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue