Commit 66882a03 authored by David Edmundson's avatar David Edmundson
Browse files

Fix keyboard handling of preset selection

The view did not have focus correctly, due in part to this and a
kirigami issue.

We also want to prevent the plasma dialog from closing when escape is
pressed. Ideally we would have a magic solution in OverlaySheet, but
after we fixed focus it is impossible to do nicely.

shortcutOverride is only invoked on the item with real active focus, not
any parents.

BUG: 430563
parent 43b07b18
......@@ -79,6 +79,7 @@ Kirigami.FormLayout {
parent: root
ListView {
implicitWidth: Kirigami.Units.gridUnit * 15
focus: true
model: controller.availablePresetsModel
delegate: Kirigami.SwipeListItem {
contentItem: QQC2.Label {
......@@ -100,6 +101,14 @@ Kirigami.FormLayout {
root.configurationChanged();
presetSheet.close();
}
// shortcut overrides can only be on the item with focus
Keys.onShortcutOverride: {
if (event.key === Qt.Key_Escape) {
event.accepted = true;
root.close();
}
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment