From c801d78949268841ad9f2d67928b35cfa0eaca51 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 20 Apr 2022 17:05:24 +1000 Subject: [PATCH] Add workaround to ensure internal pastes flagged on Windows/Qt6 Fixes #1793 --- qt/aqt/editor.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index a12c70d68..53be64bcb 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -1331,6 +1331,10 @@ class EditorWebView(AnkiWebView): def flagAnkiText(self) -> None: # be ready to adjust when clipboard event fires self._markInternal = True + # workaround broken QClipboard.dataChanged() on recent Qt6 versions + # https://github.com/ankitects/anki/issues/1793 + if is_win and qtmajor == 6: + self.editor.mw.progress.single_shot(300, self._flagAnkiText, True) def _flagAnkiText(self) -> None: # add a comment in the clipboard html so we can tell text is copied