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
key events handler return value to True to stop propagation #6397
key events handler return value to True to stop propagation #6397
Conversation
Qt does not have this notion of a 'callback' chain. Each signal can propagate to 0 or more slots, but they are, my understanding, all independently executed. |
@@ -300,14 +300,14 @@ def key_press_event(self, widget, event): | |||
key = self._get_key(event) | |||
if _debug: print("hit", key) | |||
FigureCanvasBase.key_press_event(self, key, guiEvent=event) | |||
return False # finish event propagation? | |||
return True # stoping event propagation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"stopping", not "stoping", but actually, just use "stop".
@tacaswell Qt's signals/slots mechanism is separate from its event handling (like keyboard events). Qt's event handling does have the notion of stopping the propagating of events. |
@dopplershift 🐑 For reference http://doc.qt.io/qt-4.8/eventsandfilters.html |
On a bit further reading, the notion of event propagation is handled by the method |
So with the changes in this PR we are at the same level that Qt |
MNT: key events handler return value to True to stop propagation it gtk
backported to 2.x as 9b39f3e |
Fixing #6349
Right now only stopping the key press and key release event from propagating after callback.
I am in doubt about the other events, should be stopped also?
@tacaswell how does it work in Qt?