From dc46812e5afac870ccb57762838346709b7d2fb1 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Thu, 14 Jan 2021 14:42:33 +0800 Subject: [PATCH] Qt.py : provide QOpenGLWidget (Qt5,6) instead of QGLWidget (Qt4,5) --- pyqtgraph/Qt.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/pyqtgraph/Qt.py b/pyqtgraph/Qt.py index 16cc9381..28672cbc 100644 --- a/pyqtgraph/Qt.py +++ b/pyqtgraph/Qt.py @@ -19,6 +19,7 @@ PYSIDE2 = 'PySide2' PYSIDE6 = 'PySide6' PYQT4 = 'PyQt4' PYQT5 = 'PyQt5' +PYQT6 = 'PyQt6' QT_LIB = os.getenv('PYQTGRAPH_QT_LIB') @@ -254,9 +255,9 @@ elif QT_LIB == PYSIDE6: except ImportError as err: QtSvg = FailedImport(err) try: - from PySide6 import QtOpenGL + from PySide6 import QtOpenGLWidgets except ImportError as err: - QtOpenGL = FailedImport(err) + QtOpenGLWidgets = FailedImport(err) try: from PySide6 import QtTest QtTest.QTest.qWaitForWindowShown = QtTest.QTest.qWaitForWindowExposed @@ -328,17 +329,11 @@ if QT_LIB in [PYQT5, PYSIDE2, PYSIDE6]: setattr(QtGui, o, getattr(QtWidgets,o) ) -if QT_LIB == PYSIDE6: +if QT_LIB in [PYQT6, PYSIDE6]: # We're using Qt6 which has a different structure so we're going to use a shim to # recreate the Qt5 structure - import PySide6.QtOpenGLWidgets - - class __QGLWidget(PySide6.QtOpenGLWidgets.QOpenGLWidget): - def __init__(self, parent=None, shareWidget=None): - super().__init__(parent) - - QtOpenGL.QGLWidget = __QGLWidget + QtWidgets.QOpenGLWidget = QtOpenGLWidgets.QOpenGLWidget # Common to PySide, PySide2 and PySide6