use aqt.qt to (partially) mock the old PyQt5 module
We can't import the Qt5 libraries to do it - they are not usually available, and it will lead to crashes if both are imported at once.
This commit is contained in:
parent
2d1c058106
commit
492e515c18
@ -1256,10 +1256,9 @@ QDBus.AutoDetect = QDBus.CallMode.AutoDetect
|
|||||||
QHostAddress.LocalHost = QHostAddress.SpecialAddress.LocalHost
|
QHostAddress.LocalHost = QHostAddress.SpecialAddress.LocalHost
|
||||||
QPrinter.Millimeter = QPrinter.Unit.Millimeter
|
QPrinter.Millimeter = QPrinter.Unit.Millimeter
|
||||||
|
|
||||||
# Globally alias removed PyQt5.Qt to PyQt6.QtCore.Qt
|
# Mock the removed PyQt5.Qt module
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
from . import qt5qt
|
from . import qt5qt
|
||||||
|
|
||||||
sys.modules["PyQt5.Qt"] = qt5qt
|
sys.modules["PyQt5.Qt"] = qt5qt
|
||||||
sys.modules["PyQt6.Qt"] = qt5qt
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Copyright: Ankitects Pty Ltd and contributors
|
# Copyright: Ankitects Pty Ltd and contributors
|
||||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
# 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
|
# pylint: skip-file
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -10,8 +9,8 @@ Compatibility shim for PyQt5.Qt
|
|||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from .qt5 import *
|
|
||||||
|
|
||||||
|
|
||||||
def __getattr__(name: str) -> Any:
|
def __getattr__(name: str) -> Any:
|
||||||
return getattr(Qt, name) # type: ignore
|
import aqt.qt
|
||||||
|
|
||||||
|
return getattr(aqt.qt, name)
|
||||||
|
Loading…
Reference in New Issue
Block a user