]> sigrok.org Git - pulseview.git/commitdiff
View: Use the slider value for the v-offset
authorJoel Holdsworth <redacted>
Tue, 30 Dec 2014 14:20:56 +0000 (14:20 +0000)
committerJoel Holdsworth <redacted>
Tue, 30 Dec 2014 14:24:39 +0000 (14:24 +0000)
pv/view/view.cpp
pv/view/view.hpp

index cce5e11b6f99ddb2cc4ecb4bac47707beaa6f959..5e89397aec8e5e71c7732bd7e27faedadb20f40d 100644 (file)
@@ -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();
 }
index a355cf921cdb43c00bcb5132fec4cc4dfae7d8ae..2e8aebb4c1e80d237dbbf1d1c0a4548a3dbaf11c 100644 (file)
@@ -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_;