add qtmajor qualification to version checks; update outdated min ver

This commit is contained in:
Damien Elmes 2021-10-05 11:06:34 +10:00
parent 46a1cc575c
commit 70dbd06be3
5 changed files with 4 additions and 13 deletions

View File

@ -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
):

View File

@ -1204,8 +1204,6 @@ title="{}" {}>{}</button>""".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)

View File

@ -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.")

View File

@ -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)

View File

@ -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