From: Ɓukasz Stelmach Date: Mon, 7 Dec 2020 17:09:43 +0000 (+0100) Subject: Viewport: scroll horizontally with the vertical wheel and the shift key X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f375439ffd21c497f7170dc4d5eca94e816116ce;p=pulseview.git Viewport: scroll horizontally with the vertical wheel and the shift key 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. --- diff --git a/pv/views/trace/viewport.cpp b/pv/views/trace/viewport.cpp index bab4f953..7ab24ead 100644 --- a/pv/views/trace/viewport.cpp +++ b/pv/views/trace/viewport.cpp @@ -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)