temporarily let PyQt6 6.1 run on PyQt6 6.0 ui files

This commit is contained in:
KIU Shueng Chuan 2021-04-11 09:02:58 +08:00
parent 4699bbad6b
commit 64702981d4

View File

@ -376,6 +376,15 @@ if QT_LIB == PYQT6:
QtCore.QEvent.type = new_method
del new_method
# PyQt6 6.1 renames some enums and flags to be in line with the other bindings.
# "Alignment" and "Orientations" are PyQt6 6.0 and are used in the generated
# ui files. Pending a regeneration of the template files, which would mean a
# drop in support for PyQt6 6.0, provide the old names for PyQt6 6.1.
# This is strictly a temporary private shim. Do not depend on it in your code.
if hasattr(QtCore.Qt, 'AlignmentFlag') and not hasattr(QtCore.Qt, 'Alignment'):
QtCore.Qt.Alignment = QtCore.Qt.AlignmentFlag
if hasattr(QtCore.Qt, 'Orientation') and not hasattr(QtCore.Qt, 'Orientations'):
QtCore.Qt.Orientations = QtCore.Qt.Orientation
# USE_XXX variables are deprecated
USE_PYSIDE = QT_LIB == PYSIDE