Apply same ctrl+numpad enter fix that the add screen has

Likely regression in the switch to a main window
This commit is contained in:
Damien Elmes 2023-10-26 11:57:37 +10:00
parent a7b8cb87de
commit 7428ecadc3
2 changed files with 6 additions and 4 deletions

View File

@ -109,7 +109,7 @@ class AddCards(QMainWindow):
self.addButton = bb.addButton(tr.actions_add(), ar) self.addButton = bb.addButton(tr.actions_add(), ar)
qconnect(self.addButton.clicked, self.add_current_note) qconnect(self.addButton.clicked, self.add_current_note)
self.addButton.setShortcut(QKeySequence("Ctrl+Return")) self.addButton.setShortcut(QKeySequence("Ctrl+Return"))
# qt5.14 doesn't handle numpad enter on Windows # qt5.14+ doesn't handle numpad enter on Windows
self.compat_add_shorcut = QShortcut(QKeySequence("Ctrl+Enter"), self) self.compat_add_shorcut = QShortcut(QKeySequence("Ctrl+Enter"), self)
qconnect(self.compat_add_shorcut.activated, self.addButton.click) qconnect(self.compat_add_shorcut.activated, self.addButton.click)
self.addButton.setToolTip(shortcut(tr.adding_add_shortcut_ctrlandenter())) self.addButton.setToolTip(shortcut(tr.adding_add_shortcut_ctrlandenter()))

View File

@ -28,9 +28,11 @@ class EditCurrent(QMainWindow):
self.editor.card = self.mw.reviewer.card self.editor.card = self.mw.reviewer.card
self.editor.set_note(self.mw.reviewer.card.note(), focusTo=0) self.editor.set_note(self.mw.reviewer.card.note(), focusTo=0)
restoreGeom(self, "editcurrent") restoreGeom(self, "editcurrent")
self.form.buttonBox.button(QDialogButtonBox.StandardButton.Close).setShortcut( close_button = self.form.buttonBox.button(QDialogButtonBox.StandardButton.Close)
QKeySequence("Ctrl+Return") close_button.setShortcut(QKeySequence("Ctrl+Return"))
) # qt5.14+ doesn't handle numpad enter on Windows
self.compat_add_shorcut = QShortcut(QKeySequence("Ctrl+Enter"), self)
qconnect(self.compat_add_shorcut.activated, close_button.click)
gui_hooks.operation_did_execute.append(self.on_operation_did_execute) gui_hooks.operation_did_execute.append(self.on_operation_did_execute)
self.show() self.show()