From aaceeec25a651e41e146bc8164603dbc9d9b8e9a Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 4 Oct 2021 21:15:24 +1000 Subject: [PATCH] Revert "Allow copying of images using context menu" This reverts commit d5b3927d0bbd4e75ca166cca1d76645ac841e3ec. This approach no longer appears to work in Qt6. There is a QWebEngineView.lastContextMenuRequest() that may work, though whether onCopy() qualifies as "during contextMenuEvent" is not clear. https://doc.qt.io/qt-6/qwebengineview.html#lastContextMenuRequest --- qt/aqt/webview.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index d9fd982da..dd5a4dc4a 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -282,14 +282,7 @@ class AnkiWebView(QWebEngineView): w = w.parent() def onCopy(self) -> None: - if not self.selectedText(): - if not isMac: - # crashes on a mac when clicking in the main window and pressing cmd+c - ctx = self._page.contextMenuData() - if ctx and ctx.mediaType() == QWebEngineContextMenuData.MediaTypeImage: - self.triggerPageAction(QWebEnginePage.CopyImageToClipboard) - else: - self.triggerPageAction(QWebEnginePage.Copy) + self.triggerPageAction(QWebEnginePage.Copy) def onCut(self) -> None: self.triggerPageAction(QWebEnginePage.Cut)