`QwtPlot.setMouseTracking` is ignored
ZeeD opened this issue · 1 comments
ZeeD commented
I want to detect the mouse move events over my qwt plot.
According to mouseMoveEvent
docs:
If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.
To enable the mouse tracking it should be enough to invoke setMouseTracking(True)
but it seems to me that it is ignored.
from qwt.plot import QwtPlot
from PySide6.QtGui import QMouseEvent
class MyPlot(QwtPlot):
def __init__(self) -> None:
super().__init__()
self.setMouseTracking(True)
def mouseMoveEvent(self, event: QMouseEvent) -> None:
print(event) # dummy implementation
I see the events in the stdout only if I keep the mouse button pressed, not just on "hovering" over the plot
ZeeD commented
as a workaround, if I also set self.canvas().setMouseTracking(True)
then mouseMoveEvent
is invoked, but I had to digg inside PwtPlot
to check how it worked