-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Qt5 Backend: dblclick is always False on 'mouse_release_event' #4001
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
Comments
Can you please put that in a pull request? That is the easiest way to review the changes and makes sure you get credit for your work. |
Code is largely the same as OP, see here https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/backends/backend_qt5.py#L271 @diogolr would you like to help us improve this functionality with a PR? |
What is the use for a release event on a double click? Looking at https://doc.qt.io/qt-4.8/qwidget.html#mouseDoubleClickEvent it looks like Qt does not have a notion of 'double click release'. As mpl does not have separate notion of double click events, we just tack the flag on. It also says that the widgets will get the standard button press and button release events in addition to the double click events. Experimentally, this second click is converted to the double click by Qt so we only see 2 press events (the first one + double-click) and 2 release events (the second of which is delayed until the mouse is actually released (ex press-release-press-wait-release)). I think mpl should take the same position as Qt, it is the responsibility of user code to keep track of if a release event came from the second click of a double click. If we do make this change, it should be done across all of the GUI backends (not just Qt). import datetime
import matplotlib.pyplot as plt
plt.ion()
def cb1(event):
print('p', datetime.datetime.now().isoformat(), event.dblclick)
def cb2(event):
print('r', datetime.datetime.now().isoformat(), event.dblclick)
fig, ax = plt.subplots()
fig.canvas.mpl_connect('button_press_event', cb1)
fig.canvas.mpl_connect('button_release_event', cb2)
|
Can you confirm this is still an issue? |
In Qt a double click produces the event sequence:
The same is true for matplotlib; with the only difference, that Qt has it's own event type "doubleClick" but matplotlib only uses a flag in the This is not a bug but standard behavior. Will be documented via #14188. |
Simple as that... The
dblclick
flag is alwaysFalse
onmouse_release_event
because themouseDoubleClickEvent
only callbutton_press_event
, as follow:backend_qt5.py
Can we fix this with a
button_release_event
call, also?The text was updated successfully, but these errors were encountered: