We have code which works well mixing PyQtGraph and OpenGL, but not if we
also try to stick it in a QScrollArea, in which case the leftmost visible
widget in the QScrollArea misbehaves (when you move the scrollbar the axis
first moves a smidgen, then doesn't move, then gets splatted). Is this a
Qt issue?? (I'm suspecting some makeCurrent() is not working.) Sample
code attached. The top two widgets (where we get the odd behavior) are
OpenGL-enabled and the bottom two (where everything works as expected) are
not.
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/83345fc1-ba4a-442f-90f2-b19883b79451%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
from PyQt4 import QtGui, QtCore, QtOpenGL
import pyqtgraph as pg
class MyWidget0(pg.PlotWidget):
def __init__(self, parent=None):
pg.PlotWidget.__init__(self, parent, background=(225, 255, 225))
self.setViewport(QtOpenGL.QGLWidget())
self.setViewportUpdateMode(QtGui.QGraphicsView.FullViewportUpdate)
self.setMinimumWidth(500)
class MyWidget1(pg.PlotWidget):
def __init__(self, parent=None):
pg.PlotWidget.__init__(self, parent, background=(225, 225, 255))
self.setMinimumWidth(500)
if __name__ == '__main__':
import sys
app = QtGui.QApplication(sys.argv)
mainFrame = QtGui.QFrame()
mainLayout = QtGui.QGridLayout()
mainFrame.setLayout(mainLayout)
layouts = []
for n in range(2):
scrollArea = QtGui.QScrollArea()
scrollArea.setContentsMargins(0, 0, 0, 0)
scrollArea.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
scrollArea.setWidgetResizable(True)
scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
frame = QtGui.QFrame()
layout = QtGui.QGridLayout()
frame.setLayout(layout)
scrollArea.setWidget(frame)
layouts.append(layout)
mainLayout.addWidget(scrollArea, n, 0)
for m in range(2):
widget0 = MyWidget0()
layouts[0].addWidget(widget0, 0, m)
for m in range(2):
widget1 = MyWidget1()
layouts[1].addWidget(widget1, 0, m)
mainFrame.show()
sys.exit(app.exec_())