diff --git a/pyqtgraph/Qt.py b/pyqtgraph/Qt.py index 6ae20cbb..eb5c6f32 100644 --- a/pyqtgraph/Qt.py +++ b/pyqtgraph/Qt.py @@ -450,3 +450,9 @@ def mkQApp(name=None): if name is not None: QAPP.setApplicationName(name) return QAPP + + +# exec() is used within _loadUiType, so we define as exec_() here and rename in pg namespace +def exec_(): + app = mkQApp() + return app.exec() if hasattr(app, 'exec') else app.exec_() diff --git a/pyqtgraph/__init__.py b/pyqtgraph/__init__.py index 916e937e..3edd7a20 100644 --- a/pyqtgraph/__init__.py +++ b/pyqtgraph/__init__.py @@ -11,6 +11,7 @@ __version__ = '0.12.1' ## 'Qt' is a local module; it is intended mainly to cover up the differences ## between PyQt4 and PySide. from .Qt import QtGui, mkQApp +from .Qt import exec_ as exec ## not really safe--If we accidentally create another QApplication, the process hangs (and it is very difficult to trace the cause) #if QtGui.QApplication.instance() is None: