From 238404062db14998f3b0ca93ae03a47543d219b8 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Sun, 16 Dec 2012 00:01:47 -0600 Subject: [PATCH] Viewport: Allow horizontal scrolling via mouse wheel tilting On mice with a horizontal scroll wheel, or tilting wheel, enable the user to scroll horizontally. Signed-off-by: Alexandru Gagniuc --- pv/view/viewport.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pv/view/viewport.cpp b/pv/view/viewport.cpp index 2b03b767..90f2b4b2 100644 --- a/pv/view/viewport.cpp +++ b/pv/view/viewport.cpp @@ -119,6 +119,11 @@ void Viewport::wheelEvent(QWheelEvent *event) if (event->orientation() == Qt::Vertical) { // Vertical scrolling is interpreted as zooming in/out _view.zoom(event->delta() / 120, event->x()); + } else if (event->orientation() == Qt::Horizontal) { + // Horizontal scrolling is interpreted as moving left/right + _view.set_scale_offset(_view.scale(), + event->delta() * _view.scale() + + _view.offset()); } } -- 2.30.2