actiondrawer: Dismiss on click on empty background area

This commit is contained in:
Devin Lin 2022-04-07 20:23:36 -04:00
parent 17f582a150
commit b3884be926
3 changed files with 94 additions and 73 deletions

View file

@ -54,6 +54,12 @@ PlasmaCore.ColorScope {
interval: 60 * 1000
}
MouseArea {
anchors.fill: parent
// dismiss drawer when background is clicked
onClicked: root.actionDrawer.close();
// left side
ColumnLayout {
opacity: applyMinMax(root.actionDrawer.offset / root.maximizedQuickSettingsOffset)
@ -108,6 +114,8 @@ PlasmaCore.ColorScope {
}
}
onBackgroundClicked: root.actionDrawer.close();
// don't allow notifications widget to get too wide
Layout.maximumWidth: PlasmaCore.Units.gridUnit * 25
Layout.fillHeight: true
@ -136,3 +144,4 @@ PlasmaCore.ColorScope {
}
}
}
}

View file

@ -92,6 +92,8 @@ PlasmaCore.ColorScope {
}
}
onBackgroundClicked: root.actionDrawer.close();
anchors {
top: quickSettings.top
topMargin: quickSettings.height + translate.y

View file

@ -68,6 +68,11 @@ Item {
*/
signal unlockRequested()
/**
* Emitted when the background is clicked (not a notification or other element).
*/
signal backgroundClicked()
/**
* Run pending action that was pending for authentication when unlockRequested() was emitted.
*/
@ -119,6 +124,11 @@ Item {
criteria: ViewSection.FullString
}
MouseArea {
anchors.fill: parent
onClicked: root.backgroundClicked()
}
PlasmaExtras.PlaceholderMessage {
anchors.centerIn: parent
width: parent.width - (PlasmaCore.Units.largeSpacing * 4)