]> sigrok.org Git - pulseview.git/commitdiff
Viewport: Allow horizontal scrolling via mouse wheel tilting
authorAlexandru Gagniuc <redacted>
Sun, 16 Dec 2012 06:01:47 +0000 (00:01 -0600)
committerUwe Hermann <redacted>
Fri, 21 Dec 2012 16:50:17 +0000 (17:50 +0100)
On mice with a horizontal scroll wheel, or tilting wheel, enable the user to
scroll horizontally.

Signed-off-by: Alexandru Gagniuc <redacted>
pv/view/viewport.cpp

index 2b03b76723147852cede33b727fa6e549785d21d..90f2b4b2a5a922d63a7931e47d9482c621f4d088 100644 (file)
@@ -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());
        }
 }