switch to usage of QOpenGLWidget
this drops support for Qt4
This commit is contained in:
parent
dc46812e5a
commit
9145d7f24d
@ -1,4 +1,4 @@
|
|||||||
from ..Qt import QtCore, QtGui, QtOpenGL, QT_LIB
|
from ..Qt import QtCore, QtGui, QtWidgets, QT_LIB
|
||||||
from OpenGL.GL import *
|
from OpenGL.GL import *
|
||||||
import OpenGL.GL.framebufferobjects as glfbo
|
import OpenGL.GL.framebufferobjects as glfbo
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@ -9,7 +9,7 @@ from .. import functions as fn
|
|||||||
|
|
||||||
ShareWidget = None
|
ShareWidget = None
|
||||||
|
|
||||||
class GLViewWidget(QtOpenGL.QGLWidget):
|
class GLViewWidget(QtWidgets.QOpenGLWidget):
|
||||||
|
|
||||||
def __init__(self, parent=None, devicePixelRatio=None, rotationMethod='euler'):
|
def __init__(self, parent=None, devicePixelRatio=None, rotationMethod='euler'):
|
||||||
"""
|
"""
|
||||||
@ -30,13 +30,7 @@ class GLViewWidget(QtOpenGL.QGLWidget):
|
|||||||
================ ==============================================================
|
================ ==============================================================
|
||||||
"""
|
"""
|
||||||
|
|
||||||
global ShareWidget
|
QtWidgets.QOpenGLWidget.__init__(self, parent)
|
||||||
|
|
||||||
if ShareWidget is None:
|
|
||||||
## create a dummy widget to allow sharing objects (textures, shaders, etc) between views
|
|
||||||
ShareWidget = QtOpenGL.QGLWidget()
|
|
||||||
|
|
||||||
QtOpenGL.QGLWidget.__init__(self, parent, ShareWidget)
|
|
||||||
|
|
||||||
self.setFocusPolicy(QtCore.Qt.ClickFocus)
|
self.setFocusPolicy(QtCore.Qt.ClickFocus)
|
||||||
|
|
||||||
@ -132,10 +126,7 @@ class GLViewWidget(QtOpenGL.QGLWidget):
|
|||||||
if dpr is not None:
|
if dpr is not None:
|
||||||
return dpr
|
return dpr
|
||||||
|
|
||||||
if hasattr(QtOpenGL.QGLWidget, 'devicePixelRatio'):
|
return QtWidgets.QOpenGLWidget.devicePixelRatio(self)
|
||||||
return QtOpenGL.QGLWidget.devicePixelRatio(self)
|
|
||||||
else:
|
|
||||||
return 1.0
|
|
||||||
|
|
||||||
def resizeGL(self, w, h):
|
def resizeGL(self, w, h):
|
||||||
pass
|
pass
|
||||||
|
@ -8,7 +8,7 @@ Distributed under MIT/X11 license. See license.txt for more infomation.
|
|||||||
from ..Qt import QtCore, QtGui
|
from ..Qt import QtCore, QtGui
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ..Qt import QtOpenGL
|
from ..Qt import QtWidgets
|
||||||
from OpenGL.GL import *
|
from OpenGL.GL import *
|
||||||
|
|
||||||
HAVE_OPENGL = True
|
HAVE_OPENGL = True
|
||||||
@ -74,7 +74,7 @@ class RawImageWidget(QtGui.QWidget):
|
|||||||
|
|
||||||
|
|
||||||
if HAVE_OPENGL:
|
if HAVE_OPENGL:
|
||||||
class RawImageGLWidget(QtOpenGL.QGLWidget):
|
class RawImageGLWidget(QtWidgets.QOpenGLWidget):
|
||||||
"""
|
"""
|
||||||
Similar to RawImageWidget, but uses a GL widget to do all drawing.
|
Similar to RawImageWidget, but uses a GL widget to do all drawing.
|
||||||
Perfomance varies between platforms; see examples/VideoSpeedTest for benchmarking.
|
Perfomance varies between platforms; see examples/VideoSpeedTest for benchmarking.
|
||||||
@ -83,7 +83,7 @@ if HAVE_OPENGL:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, parent=None, scaled=False):
|
def __init__(self, parent=None, scaled=False):
|
||||||
QtOpenGL.QGLWidget.__init__(self, parent)
|
QtWidgets.QOpenGLWidget.__init__(self, parent)
|
||||||
self.scaled = scaled
|
self.scaled = scaled
|
||||||
self.image = None
|
self.image = None
|
||||||
self.uploaded = False
|
self.uploaded = False
|
||||||
|
Loading…
Reference in New Issue
Block a user