From: Soeren Apel Date: Wed, 3 Dec 2014 09:39:41 +0000 (+0100) Subject: View: Make horizontal arrow-key scrolling useful X-Git-Tag: pulseview-0.3.0~408 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=d7aae647fee176f7a0257f65b4e5d7fda81744c3 View: Make horizontal arrow-key scrolling useful Currently, the horizontal scroll bar scrolls by a very small amount of time when the arrow keys on the keyboard are used. This is because View::horizontalScrollBar's single step size is never set. In order to make the arrow keys become useful, this patch sets this step size equal to the major tick width of the ruler. This results in scrolling by a fair amount of time without losing track of the context and also preserving the positions of the major ticks on the ruler when scrolling. --- diff --git a/pv/view/view.cpp b/pv/view/view.cpp index fce5b18c..5877c22d 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -451,7 +451,10 @@ void View::update_scroll() get_scroll_layout(length, offset); length = max(length - areaSize.width(), 0.0); + int major_tick_distance = tick_period_ / scale_; + horizontalScrollBar()->setPageStep(areaSize.width() / 2); + horizontalScrollBar()->setSingleStep(major_tick_distance); updating_scroll_ = true;