1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-11 16:02:51 -05:00

escape key handling

This commit is contained in:
bbedward
2025-08-05 09:15:27 -04:00
parent ef9e80bfdf
commit fccaf06baa
11 changed files with 191 additions and 19 deletions

View File

@@ -185,15 +185,28 @@ PanelWindow {
FocusScope {
id: focusScope
objectName: "modalFocusScope"
anchors.fill: parent
visible: root.visible // Only active when the modal is visible
focus: root.visible
Keys.onEscapePressed: (event) => {
if (root.closeOnEscapeKey) {
root.visible = false;
event.accepted = true;
}
}
onVisibleChanged: {
if (visible) {
Qt.callLater(function() {
focusScope.forceActiveFocus();
});
}
}
}
// Expose the focusScope for external access
property alias modalFocusScope: focusScope
}