switch to use of QOpenGLWidget in GraphicsView.py#1525
switch to use of QOpenGLWidget in GraphicsView.py#1525j9ac9k merged 3 commits intopyqtgraph:masterfrom
Conversation
experimental plotting in PlotCurveItem gets broken by this. so we allow Qt5 users to opt back to using QGLWidget with the enableExperimental option.
|
Do you think it is worth attempting to try and get Looking at the Qt Bucktracker, I have found
I didn't notice any workarounds in those issues unfortunately. |
|
On PyQt6, after removing the How was PlotCurveItem broken for you? EDIT: wait, I messed something up, investigating further... EDIT2: Got it working with a ridiculous if-check in if HAVE_OPENGL and \
(
(
getConfigOption('enableExperimental') and \
hasattr(QtOpenGL, 'QGLWidget') and \
isinstance(widget, QtOpenGL.QGLWidget)
) or \
(
hasattr(QtWidgets, 'QOpenGLWidget') and \
isinstance(widget, QtWidgets.QOpenGLWidget)
)
):
self.paintGL(p, opt, widget)
returnwith PyQt6 on macOS, this block of code is run ( Given this is the only place that EDIT3: I also had to add this to my PyQt6 block: try:
from PyQt6 import QtOpenGL
except ImportError as err:
QtOpenGL = FailedImport(err)
EDIT4: Got it working with PySide6 with the same changes as I made for PyQt6. |
to more easily allow users to see the broken-ness.
|
I do have access to a Windows machine so I'll see if I can replicate there.
…On Fri, Jan 29, 2021 at 22:39 pijyoi ***@***.***> wrote:
I get the following on Windows 10 when using QOpenGLWidget on either Qt5
and Qt6. So maybe it is OS dependent.
[image: qt6_opengl_mouse_selection]
<https://user-images.githubusercontent.com/2657027/106349317-0a61c580-6308-11eb-91c8-813751e11820.PNG>
I didn't import QtOpenGL in Qt.py for Qt6 because it is not used. So, in
the previous code, Qt6 users would get a QtOpenGL import failure and thus
have HAVE_OPENGL = False.
I have modified the code to allow Qt6 users to turn on enableExperimental.
After all, it is an opt-in.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1525 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE5Z7VXRFHDHFVS4Z655N3S4OSSLANCNFSM4WZ2IF7Q>
.
|
|
I just tried it on Linux and it seems to work. |
As a user, I could want to enable useOpenGL without enabling enableExperimental. I would like to ditch QGLWidget even if that breaks Windows. Users affected are those who had opted in to enableExperimental. |
|
I get the same problem on windows with PyQt5 5.15 and PyQt6. |
|
This PR LGTM, code is much cleaner, no more ambiguity between QGLWidget vs. QOpenGLWidget... Thanks so much for doing this @pijyoi ! |
|
Maybe the following code might give a clue to someone knowledgeable with Windows OpenGL. import numpy as np
import pyqtgraph as pg
pg.setConfigOption('useOpenGL', True)
pg.setConfigOption('enableExperimental', True)
app = pg.mkQApp()
win = pg.plot()
xxx = np.linspace(-1, 1, 1000)
yyy = np.sin(2*np.pi*3*xxx)
curve = pg.PlotCurveItem(x=xxx, y=yyy, pen='g', clickable=True)
win.addItem(curve)
app.exec_() |
|
@pijyoi do you happen to have a hidpi display or use fractional scaling (150% or 175%?) by chance? |
|
No, I have neither as a monitor.
…On Sun, 31 Jan 2021 at 12:57, Ogi Moore ***@***.***> wrote:
@pijyoi <https://github.com/pijyoi> do you happen to have a hidpi display
or use fractional scaling (150% or 175%?) by chance?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1525 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUIWAZIVQTRWOLXUWWZ6M3S4TPNLANCNFSM4WZ2IF7Q>
.
|
For Qt5, this switches from use of legacy QGLWidget to QOpenGLWidget.
For Qt6, this enables the option of using OpenGL, also using QOpenGLWidget.
Experimental plotting in PlotCurveItem gets broken by this switch and I do not know how to fix it, so we allow Qt5 users to opt back to using QGLWidget with the enableExperimental option.
There is some discussion here about issues with switching from QGLWidget to QOpenGLWidget when using them as a viewport.
https://stackoverflow.com/questions/31658176/using-qopenglwidget-with-qgraphicsview-viewport-not-updating