From: Alexandru Gagniuc Date: Sat, 26 Jan 2013 06:35:17 +0000 (-0600) Subject: View: Decouple horizontal scrolling from the scoll bar X-Git-Tag: pulseview-0.1.0~140 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=149e359e48ede480f3734cfc5c04bd1399d0d4be;p=pulseview.git View: Decouple horizontal scrolling from the scoll bar Scrolling horizontally, regardless if through the tilt wheel, dragging the signals, or moving the scroll bar, updates the viewport and the scroll bar. This triggered a valueChanged() signal from the scroll bar, causing the viewport to be updated again (redundantly). The operation of the viewport became dependent on the scroll bar. On high zoom levels, where the scroll bar's resolution is limited, the coupling manifested as jitter. The view was rendered with the proper resolution of, caused the mouse drag event, then immediately updated and rendered with the limited resolution of the scroll bar. Decouple the viewport from the valueChanged() signal, and use the sliderMoved() signal instead. The scroll bar becomes a simple input element, and only causes a viewport update when acted upon by the user. Using the scroll bar is still limited in resolution, but other scrolling methods are no longer affected by the limitations of the scroll bar. This fixes bug 7. Signed-off-by: Alexandru Gagniuc --- diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 34676334..b52d689f 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -75,8 +75,8 @@ View::View(SigSession &session, QWidget *parent) : Cursor(*this, 1.0))), _hover_point(-1, -1) { - connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(h_scroll_value_changed(int))); + connect(horizontalScrollBar(), SIGNAL(sliderMoved(int)), + this, SLOT(h_scroll_moved(int))); connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(v_scroll_value_changed(int))); @@ -288,7 +288,7 @@ void View::resizeEvent(QResizeEvent*) update_scroll(); } -void View::h_scroll_value_changed(int value) +void View::h_scroll_moved(int value) { const int range = horizontalScrollBar()->maximum(); if (range < MaxScrollValue) diff --git a/pv/view/view.h b/pv/view/view.h index 5a10ee9e..dd0ad6ca 100644 --- a/pv/view/view.h +++ b/pv/view/view.h @@ -128,7 +128,7 @@ private: private slots: - void h_scroll_value_changed(int value); + void h_scroll_moved(int value); void v_scroll_value_changed(int value); void signals_changed();