From 70dbd06be3ff56f13b9efe7c886c2a6c4f873ce9 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 5 Oct 2021 11:06:34 +1000 Subject: [PATCH] add qtmajor qualification to version checks; update outdated min ver --- qt/aqt/__init__.py | 1 + qt/aqt/main.py | 2 -- qt/aqt/qt.py | 2 +- qt/aqt/utils.py | 4 +--- qt/aqt/webview.py | 8 +------- 5 files changed, 4 insertions(+), 13 deletions(-) diff --git a/qt/aqt/__init__.py b/qt/aqt/__init__.py index 0ac2f3b65..d61350d91 100644 --- a/qt/aqt/__init__.py +++ b/qt/aqt/__init__.py @@ -515,6 +515,7 @@ def _run(argv: Optional[list[str]] = None, exec: bool = True) -> Optional[AnkiAp if ( isWin + and qtmajor == 5 and (qtminor == 14 or (qtminor == 15 and qtpoint == 0)) and "QT_QPA_PLATFORM" not in os.environ ): diff --git a/qt/aqt/main.py b/qt/aqt/main.py index a2f97b78d..344186cc1 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -1204,8 +1204,6 @@ title="{}" {}>{}""".format( qconnect(m.actionAbout.triggered, self.onAbout) qconnect(m.actionUndo.triggered, self.undo) qconnect(m.actionRedo.triggered, self.redo) - if qtminor < 11: - m.actionUndo.setShortcut(QKeySequence("Ctrl+Alt+Z")) qconnect(m.actionFullDatabaseCheck.triggered, self.onCheckDB) qconnect(m.actionCheckMediaDatabase.triggered, self.on_check_media_db) qconnect(m.actionDocumentation.triggered, self.onDocumentation) diff --git a/qt/aqt/qt.py b/qt/aqt/qt.py index f8b2f1ce7..46cf9f6e7 100644 --- a/qt/aqt/qt.py +++ b/qt/aqt/qt.py @@ -53,7 +53,7 @@ qtmajor = (QT_VERSION & 0xFF0000) >> 16 qtminor = (QT_VERSION & 0x00FF00) >> 8 qtpoint = QT_VERSION & 0xFF -if qtmajor != 5 or qtminor < 9 or qtminor == 10: +if qtmajor < 5 or (qtmajor == 5 and qtminor < 14): raise Exception("Anki does not support your Qt version.") diff --git a/qt/aqt/utils.py b/qt/aqt/utils.py index a972d1b8d..a124bdb64 100644 --- a/qt/aqt/utils.py +++ b/qt/aqt/utils.py @@ -515,7 +515,7 @@ def restoreGeom( if aqt.mw.pm.profile.get(key): widget.restoreGeometry(aqt.mw.pm.profile[key]) if isMac and offset: - if qtminor > 6: + if qtmajor > 5 or qtminor > 6: # bug in osx toolkit s = widget.size() widget.resize(s.width(), s.height() + offset * 2) @@ -828,8 +828,6 @@ class MenuItem: def qtMenuShortcutWorkaround(qmenu: QMenu) -> None: - if qtminor < 10: - return for act in qmenu.actions(): act.setShortcutVisibleInContextMenu(True) diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index dd5a4dc4a..4754ba928 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -346,13 +346,7 @@ class AnkiWebView(QWebEngineView): if isLin: factor = max(1, factor) return factor - # compensate for qt's integer scaling on windows? - if qtminor >= 14: - return 1 - qtIntScale = self._getQtIntScale(screen) - desiredScale = factor * qtIntScale - newFactor = desiredScale / qtIntScale - return max(1, newFactor) + return 1 def _getQtIntScale(self, screen: QWidget) -> int: # try to detect if Qt has scaled the screen