From de78b84eba10f33d2f683191629c75364128a1f5 Mon Sep 17 00:00:00 2001 From: "A. Reit" Date: Tue, 16 Jan 2024 18:08:48 +0100 Subject: [PATCH] Qt 6: QApplication: Make exec_() a simple alias for exec() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make exec_() a simple alias for exec() instead of using the possibly_static_exec() helper. Using the helper is not required. Moreover, the helper doesn’t behave correctly if QApplication is monkey patched [1]. [1] as in from qtpy import QtWidgets class PatchedQApplication(QtWidgets.QApplication): ... QtWidgets.QApplication = PatchedQApplication --- qtpy/QtWidgets.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/qtpy/QtWidgets.py b/qtpy/QtWidgets.py index 1b225421..f0d0a317 100644 --- a/qtpy/QtWidgets.py +++ b/qtpy/QtWidgets.py @@ -79,11 +79,7 @@ def __getattr__(name): *args, **kwargs, ) - QApplication.exec_ = lambda *args, **kwargs: possibly_static_exec( - QApplication, - *args, - **kwargs, - ) + QApplication.exec_ = QApplication.exec QDialog.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) QMenu.exec_ = lambda *args, **kwargs: possibly_static_exec( QMenu, @@ -149,11 +145,7 @@ def __getattr__(name): ) # Map DeprecationWarning methods - QApplication.exec_ = lambda *args, **kwargs: possibly_static_exec( - QApplication, - *args, - **kwargs, - ) + QApplication.exec_ = QApplication.exec QDialog.exec_ = lambda self, *args, **kwargs: self.exec(*args, **kwargs) QMenu.exec_ = lambda *args, **kwargs: possibly_static_exec( QMenu,