Hi, I started building a plugin for QGIS using PyQtGraph, as it is much quicker than MatPlotLib, and it is modeled around a scenegraph, which suits me fine.
I need to do a lot of custom drawing, so my code is built around the customGraphicsItem.py example.
My graphics class starts as follows:
class RollSurvey(pg.GraphicsObject):
def __init__(self, name: str = 'Untitled')-> None: # assign default name value
pg.GraphicsObject.__init__(self)
etc...
To keep the paint effort manageable, I am using four different levels-of-detail (LOD) similar to the Qt 40000-chips example found
here.
Here's my problem; in order to keep the plotting responsive
when the user is panning the
plot, I need to step back by (at least) one level-of-detail. But I have not been able to properly capture the mouse-down status, in order to reduce drawing effort whilst panning. The event sequence that I observe is :
QEvent::WindowActivate
QEvent::GrabMouse
QEvent::GraphicsSceneMousePress
QEvent::UngrabMouse
Painting - Mouse grabbed: False
Painting - Mouse grabbed: False
Painting - Mouse grabbed: False
Painting - Mouse grabbed: False
Painting - Mouse grabbed: False
I set the mouseGrabbed = True condition when the "GrabMouse" event occurs and reset it at "UngrabMouse".
What I do not understand is that the mouse is already "ungrabbed" before painting starts...
Any suggestions what I am doing wrong / overlooking here ?
Thanks very much.