Get the runtime Qt version instead of the compile-time version

PyQt sometimes bumps the Qt libraries without changing the Python side
This commit is contained in:
Damien Elmes 2022-09-21 12:21:10 +10:00
parent bff76727fe
commit 192dfe8185
3 changed files with 7 additions and 5 deletions

View file

@ -108,7 +108,7 @@ def show(mw: aqt.AnkiQt) -> QDialog:
abouttext += f"<p>{tr.about_version(val=version_with_build())}<br>"
abouttext += ("Python %s Qt %s PyQt %s<br>") % (
platform.python_version(),
QT_VERSION_STR,
qVersion(),
PYQT_VERSION_STR,
)
abouttext += (

View file

@ -45,9 +45,10 @@ if os.environ.get("DEBUG"):
sys.excepthook = info
qtmajor = (QT_VERSION & 0xFF0000) >> 16
qtminor = (QT_VERSION & 0x00FF00) >> 8
qtpoint = QT_VERSION & 0xFF
_version = QLibraryInfo.version()
qtmajor = _version.majorVersion()
qtminor = _version.minorVersion()
qtpoint = _version.microVersion()
if qtmajor < 5 or (qtmajor == 5 and qtminor < 14):
raise Exception("Anki does not support your Qt version.")

View file

@ -73,6 +73,7 @@ from aqt.qt import (
qconnect,
qtmajor,
qtminor,
qVersion,
traceback,
)
from aqt.theme import theme_manager
@ -1089,7 +1090,7 @@ Add-ons, last update check: {}
""".format(
version_with_build(),
platform.python_version(),
QT_VERSION_STR,
qVersion(),
PYQT_VERSION_STR,
platname,
getattr(sys, "frozen", False),