Fix Ctrl-Enter shortcut

This commit is contained in:
Loren Burkholder 2021-07-17 18:24:38 -04:00
parent f30c3db860
commit 155315ecbb

View file

@ -29,11 +29,9 @@ ApplicationWindow {
height: 380 height: 380
width: 340 width: 340
// TODO: make this work in the TextField Keys.onShortcutOverride: event.accepted = ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && event.modifiers & Qt.ControlModifier)
Shortcut { Keys.onEnterPressed: if (event.modifiers & Qt.ControlModifier) invitees.accept()
sequence: "Ctrl+Enter" Keys.onReturnPressed: if (event.modifiers & Qt.ControlModifier) invitees.accept()
onActivated: invitees.accept()
}
Shortcut { Shortcut {
sequence: StandardKey.Cancel sequence: StandardKey.Cancel
@ -66,10 +64,14 @@ ApplicationWindow {
} }
Component.onCompleted: forceActiveFocus() Component.onCompleted: forceActiveFocus()
Shortcut { // Shortcut {
sequence: "Ctrl+Enter" // sequence: "Ctrl+Enter"
onActivated: invitees.accept() // onActivated: invitees.accept()
} // }
Keys.onShortcutOverride: event.accepted = ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && event.modifiers & Qt.ControlModifier)
Keys.onEnterPressed: if (event.modifiers & Qt.ControlModifier) invitees.accept()
Keys.onReturnPressed: if (event.modifiers & Qt.ControlModifier) invitees.accept()
} }