From: Joel Holdsworth Date: Tue, 30 Dec 2014 14:20:56 +0000 (+0000) Subject: View: Use the slider value for the v-offset X-Git-Tag: pulseview-0.3.0~286 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f84000171de7e569590a2f766ae36290b73442da;p=pulseview.git View: Use the slider value for the v-offset --- diff --git a/pv/view/view.cpp b/pv/view/view.cpp index cce5e11b..5e89397a 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -92,7 +92,6 @@ View::View(Session &session, QWidget *parent) : header_(new Header(*this)), scale_(1e-6), offset_(0), - v_offset_(0), updating_scroll_(false), tick_period_(0.0), tick_prefix_(0), @@ -104,7 +103,7 @@ View::View(Session &session, QWidget *parent) : connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(h_scroll_value_changed(int))); connect(verticalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(v_scroll_value_changed(int))); + this, SLOT(v_scroll_value_changed())); connect(&session_, SIGNAL(signals_changed()), this, SLOT(signals_changed())); @@ -202,7 +201,7 @@ double View::offset() const int View::owner_visual_v_offset() const { - return -v_offset_; + return -verticalScrollBar()->sliderPosition(); } unsigned int View::depth() const @@ -656,9 +655,8 @@ void View::h_scroll_value_changed(int value) viewport_->update(); } -void View::v_scroll_value_changed(int value) +void View::v_scroll_value_changed() { - v_offset_ = value; header_->update(); viewport_->update(); } diff --git a/pv/view/view.hpp b/pv/view/view.hpp index a355cf92..2e8aebb4 100644 --- a/pv/view/view.hpp +++ b/pv/view/view.hpp @@ -102,6 +102,10 @@ public: * seconds. */ double offset() const; + + /** + * Returns the vertical scroll offset. + */ int owner_visual_v_offset() const; /** @@ -249,7 +253,7 @@ public: private Q_SLOTS: void h_scroll_value_changed(int value); - void v_scroll_value_changed(int value); + void v_scroll_value_changed(); void signals_changed(); void data_updated(); @@ -271,7 +275,6 @@ private: /// The view time offset in seconds. double offset_; - int v_offset_; bool updating_scroll_; double tick_period_;