• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jni / vispy / 12291385307

09 Nov 2024 03:17PM UTC coverage: 69.903% (+0.004%) from 69.899%
12291385307

push

github

web-flow
Add modifiers to QT native gesture events (#2631)

### Why this PR?

Mouse Events forwarded from QT to the canvas events have a `modifers`
attribute that is very useful to create enhanced interactions. For
instance it can be used to make CONTROL + zoom behave like a slower zoom
to better manipulate the camera.

Sadly when the QT event is a NativeGesture event, the current qt backend
(_qt.py) does not forward this list of modifiers.

This PR fixes this so that we can have access to the modifiers when
handling a QT native gesture event in vispy.

### What are the changes?

This PR just adds a `modifiers` attribute to these events, exactly as
it's done with the classic mouse events. It works the same because
QNativeGestureEvent inherits from QInputEvent
(https://doc.qt.io/qtforpython-6/PySide6/QtGui/QInputEvent.html#PySide6.QtGui.QInputEvent)
that has the `modifiers` method.

### About the tests

I couldn't find any test about the forwarding of QT events so I didn't
change any specific test in this PR

### Note

For the moment QT does not forward the keys pressed to the `modifiers`
of the QNativeGestureEvents but :
- the interface exists on the QT side (the method `modifiers` exists)
- it allows for a more homogenous interface on vispy side (mouse events
& gesture events share a better interface)
- QT will hopefully fill in the modifiers in QNativeGestureEvents in a
future update: better be ready ;)

5794 of 10522 branches covered (55.07%)

Branch coverage included in aggregate %.

23981 of 32073 relevant lines covered (74.77%)

2.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.32
/vispy/geometry/triangulation.py


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc