Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QwtPlot.setMouseTracking is ignored #88

Open
ZeeD opened this issue Aug 15, 2024 · 1 comment
Open

QwtPlot.setMouseTracking is ignored #88

ZeeD opened this issue Aug 15, 2024 · 1 comment

Comments

@ZeeD
Copy link

ZeeD commented Aug 15, 2024

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
Copy link
Author

ZeeD commented Aug 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant