diff options
| author | Christian Tismer <tismer@stackless.com> | 2024-02-13 18:18:37 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-03-05 13:37:13 +0100 |
| commit | fb0270f39de6ed190a114b8b87afe9ba9b4d93b1 (patch) | |
| tree | f145ca0d2e2e61aac463f789df3a45f088e64ea8 /sources/pyside6/PySide6/support/deprecated.py | |
| parent | d985296478c053202e41999bcb1826cf055652b1 (diff) | |
Enum: Move special Flag patch into a snippet
A patch that corrects Qt.Modifier and Qt.KeyboardModifier
causes early loading of QtCore.Qt .
Move the patch into snippets, running it only when needed.
Task-number: PYSIDE-1735
Task-number: PYSIDE-2404
Change-Id: I26cc7aa767d5474bf54a22fbad24fae62daafa5f
Pick-to: 6.6
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/support/deprecated.py')
| -rw-r--r-- | sources/pyside6/PySide6/support/deprecated.py | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/sources/pyside6/PySide6/support/deprecated.py b/sources/pyside6/PySide6/support/deprecated.py index f215f2ff5..263dd3ed7 100644 --- a/sources/pyside6/PySide6/support/deprecated.py +++ b/sources/pyside6/PySide6/support/deprecated.py @@ -13,59 +13,6 @@ Functions that are to be called for Note that this fixing code is run after all initializations, but before the import is finished. But that is no problem since the module is passed in. - -PYSIDE-1735: This is also used now for missing other functions (overwriting __or__ - in Qt.(Keyboard)Modifier). """ -import warnings -from textwrap import dedent - - -class PySideDeprecationWarningRemovedInQt6(Warning): - pass - - -def constData(self): - cls = self.__class__ - name = cls.__qualname__ - warnings.warn(dedent(f""" - {name}.constData is unpythonic and will be removed in Qt For Python 6.0 . - Please use {name}.data instead."""), PySideDeprecationWarningRemovedInQt6, stacklevel=2) - return cls.data(self) - - -# No longer needed but kept for reference. -def _unused_fix_for_QtGui(QtGui): - for name, cls in QtGui.__dict__.items(): - if name.startswith("QMatrix") and "data" in cls.__dict__: - cls.constData = constData - -# PYSIDE-1735: Fix for a special enum function -def fix_for_QtCore(QtCore): - from enum import Flag - Qt = QtCore.Qt - flag_or = Flag.__or__ - - def func_or(self, other): - if isinstance(self, Flag) and isinstance(other, Flag): - # this is normal or-ing flags together - return Qt.KeyboardModifier(self.value | other.value) - return QtCore.QKeyCombination(self, other) - - def func_add(self, other): - warnings.warn(dedent(f""" - The "+" operator is deprecated in Qt For Python 6.0 . - Please use "|" instead."""), PySideDeprecationWarningRemovedInQt6, stacklevel=2) - return func_or(self, other) - - Qt.KeyboardModifier.__or__ = func_or - Qt.KeyboardModifier.__ror__ = func_or - Qt.Modifier.__or__ = func_or - Qt.Modifier.__ror__ = func_or - Qt.KeyboardModifier.__add__ = func_add - Qt.KeyboardModifier.__radd__ = func_add - Qt.Modifier.__add__ = func_add - Qt.Modifier.__radd__ = func_add - # eof |
