X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fviewport.cpp;h=03b07fdf13351d3ceab1e8720af701f503046335;hb=30fcfd9f5b348da5123f0a25c943e40209be95b1;hp=7d844d27bccadd71a287f5aeb784f9d5f1ad5f85;hpb=2e57535108a0ae2e5d1ee454f1e61b71d23afdb3;p=pulseview.git diff --git a/pv/view/viewport.cpp b/pv/view/viewport.cpp index 7d844d2..03b07fd 100644 --- a/pv/view/viewport.cpp +++ b/pv/view/viewport.cpp @@ -41,24 +41,28 @@ Viewport::Viewport(View &parent) : setMouseTracking(true); setAutoFillBackground(true); setBackgroundRole(QPalette::Base); + + connect(&_view, SIGNAL(signals_moved()), + this, SLOT(on_signals_moved())); } int Viewport::get_total_height() const { - int height = 0; - BOOST_FOREACH(const shared_ptr s, - _view.session().get_signals()) { + int h = 0; + const vector< shared_ptr > sigs( + _view.session().get_signals()); + BOOST_FOREACH(const shared_ptr s, sigs) { assert(s); - height += View::SignalHeight; + h = max(s->get_v_offset() + View::SignalHeight, h); } - return height; + return h; } void Viewport::paintEvent(QPaintEvent *event) { - const vector< shared_ptr > &sigs = - _view.session().get_signals(); + const vector< shared_ptr > sigs( + _view.session().get_signals()); QPainter p(this); p.setRenderHint(QPainter::Antialiasing); @@ -142,5 +146,10 @@ void Viewport::draw_cursors_foreground(QPainter &p) cursors.second.paint(p, r); } +void Viewport::on_signals_moved() +{ + update(); +} + } // namespace view } // namespace pv