Some software (notably Gimp and Inkscape) allows horizontal scrolling
with the vertical wheel when the shift key is pressed. Implement this
behaviour for easier navigation with single wheel mice.
---
 pv/views/trace/viewport.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pv/views/trace/viewport.cpp b/pv/views/trace/viewport.cpp
index a2d0b99a..67ee623c 100644
--- a/pv/views/trace/viewport.cpp
+++ b/pv/views/trace/viewport.cpp
@@ -231,6 +231,12 @@ void Viewport::wheelEvent(QWheelEvent *event)
                        // is intrepretted as vertical scrolling
                        view_.set_v_offset(-view_.owner_visual_v_offset() -
                                (event->delta() * height()) / (8 * 120));
+               } else if (event->modifiers() & Qt::ShiftModifier) {
+                       // Vertical scrolling with the shift key pressed
+                       // acts as horizontal scrolling like in Gimp
+                       // and Inkscape.
+                       view_.set_scale_offset(view_.scale(),
+                               -event->delta() * view_.scale() + 
view_.offset());
                } else {
                        // Vertical scrolling is interpreted as zooming in/out
                        view_.zoom(event->delta() / 120.0, event->x());
-- 
2.20.1



_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to