]> sigrok.org Git - pulseview.git/blobdiff - pv/views/trace/viewport.cpp
Viewport: scroll horizontally with the vertical wheel and the shift key
[pulseview.git] / pv / views / trace / viewport.cpp
index bab4f95368aa55569ef95bffb2c91a712b72d3e5..7ab24eadd3ffd9bd4f8edd30679d8cde0de74f08 100644 (file)
@@ -241,6 +241,12 @@ void Viewport::wheelEvent(QWheelEvent *event)
                        // is intrepretted as vertical scrolling
                        view_.set_v_offset(-view_.owner_visual_v_offset() -
                                (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(),
+                               - delta * view_.scale() + view_.offset());
                } else {
                        // Vertical scrolling is interpreted as zooming in/out
 #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)