remove old Mac shortcut code completely

The shortcuts seem to work correctly without it on Qt 5.14, so this
code seems to have only been required for older Qt releases.
This commit is contained in:
Damien Elmes 2021-07-04 16:00:23 +10:00
parent 5989fb8ef6
commit a54f181ae0
2 changed files with 1 additions and 20 deletions

View File

@ -1052,7 +1052,7 @@ $editorToolbar.then(({{ toolbar }}) => toolbar.appendGroup({{
class EditorWebView(AnkiWebView): class EditorWebView(AnkiWebView):
def __init__(self, parent: QWidget, editor: Editor) -> None: def __init__(self, parent: QWidget, editor: Editor) -> None:
AnkiWebView.__init__(self, title="editor", mac_default_shortcuts=False) AnkiWebView.__init__(self, title="editor")
self.editor = editor self.editor = editor
self.setAcceptDrops(True) self.setAcceptDrops(True)
self._markInternal = False self._markInternal = False

View File

@ -213,8 +213,6 @@ class AnkiWebView(QWebEngineView):
self, self,
parent: Optional[QWidget] = None, parent: Optional[QWidget] = None,
title: str = "default", title: str = "default",
*,
mac_default_shortcuts: bool = True,
) -> None: ) -> None:
QWebEngineView.__init__(self, parent=parent) QWebEngineView.__init__(self, parent=parent)
self.set_title(title) self.set_title(title)
@ -242,23 +240,6 @@ class AnkiWebView(QWebEngineView):
context=Qt.WidgetWithChildrenShortcut, context=Qt.WidgetWithChildrenShortcut,
activated=self.onEsc, activated=self.onEsc,
) )
if isMac and mac_default_shortcuts:
for key, fn in [
(QKeySequence.Copy, self.onCopy),
(QKeySequence.Paste, self.onPaste),
(QKeySequence.Cut, self.onCut),
(QKeySequence.SelectAll, self.onSelectAll),
]:
QShortcut( # type: ignore
key, self, context=Qt.WidgetWithChildrenShortcut, activated=fn
)
QShortcut( # type: ignore
QKeySequence("ctrl+shift+v"),
self,
context=Qt.WidgetWithChildrenShortcut,
activated=self.onPaste,
)
def set_title(self, title: str) -> None: def set_title(self, title: str) -> None:
self.title = title # type: ignore[assignment] self.title = title # type: ignore[assignment]