diff --git a/qt/aqt/qt/compat.py b/qt/aqt/qt/compat.py index 40e4dbf48..dbd9a4ec7 100644 --- a/qt/aqt/qt/compat.py +++ b/qt/aqt/qt/compat.py @@ -1256,10 +1256,9 @@ QDBus.AutoDetect = QDBus.CallMode.AutoDetect QHostAddress.LocalHost = QHostAddress.SpecialAddress.LocalHost QPrinter.Millimeter = QPrinter.Unit.Millimeter -# Globally alias removed PyQt5.Qt to PyQt6.QtCore.Qt +# Mock the removed PyQt5.Qt module ########################################################################## from . import qt5qt sys.modules["PyQt5.Qt"] = qt5qt -sys.modules["PyQt6.Qt"] = qt5qt diff --git a/qt/aqt/qt/qt5qt.py b/qt/aqt/qt/qt5qt.py index a12392bf4..f606e8472 100644 --- a/qt/aqt/qt/qt5qt.py +++ b/qt/aqt/qt/qt5qt.py @@ -1,7 +1,6 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -# make sure not to optimize imports on this file # pylint: skip-file """ @@ -10,8 +9,8 @@ Compatibility shim for PyQt5.Qt from typing import Any -from .qt5 import * - def __getattr__(name: str) -> Any: - return getattr(Qt, name) # type: ignore + import aqt.qt + + return getattr(aqt.qt, name)