X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fviewport.cpp;h=c987c3683164e598d9c1f94e8b0a88560ad33920;hb=eae6e30af53f6b3e42dc5be212c82870078276b0;hp=f0c78e67fcd727bdea0249120259b80331f8f1b1;hpb=300fc11ea8ec416b31c7dbc3d3d52277af24d1b7;p=pulseview.git diff --git a/pv/view/viewport.cpp b/pv/view/viewport.cpp index f0c78e6..c987c36 100644 --- a/pv/view/viewport.cpp +++ b/pv/view/viewport.cpp @@ -19,6 +19,7 @@ */ #include +#include #include "view.h" #include "viewport.h" @@ -28,6 +29,7 @@ #include +using std::abs; using std::max; using std::min; using std::shared_ptr; @@ -62,10 +64,10 @@ Viewport::Viewport(View &parent) : int Viewport::get_total_height() const { int h = 0; - const vector< shared_ptr > traces(_view.get_traces()); - for (const shared_ptr t : traces) { - assert(t); - h = max(t->get_v_offset() + View::SignalHeight, h); + const vector< shared_ptr > row_items(_view.child_items()); + for (const shared_ptr r : row_items) { + assert(r); + h = max(r->v_offset() + View::SignalHeight, h); } return h; @@ -73,7 +75,7 @@ int Viewport::get_total_height() const void Viewport::paintEvent(QPaintEvent*) { - const vector< shared_ptr > traces(_view.get_traces()); + const vector< shared_ptr > row_items(_view.child_items()); QPainter p(this); p.setRenderHint(QPainter::Antialiasing); @@ -82,17 +84,17 @@ void Viewport::paintEvent(QPaintEvent*) _view.cursors().draw_viewport_background(p, rect()); // Plot the signal - for (const shared_ptr t : traces) + for (const shared_ptr r : row_items) { - assert(t); - t->paint_back(p, 0, width()); + assert(r); + r->paint_back(p, 0, width()); } - for (const shared_ptr t : traces) - t->paint_mid(p, 0, width()); + for (const shared_ptr r : row_items) + r->paint_mid(p, 0, width()); - for (const shared_ptr t : traces) - t->paint_fore(p, 0, width()); + for (const shared_ptr r : row_items) + r->paint_fore(p, 0, width()); if (_view.cursors_shown()) _view.cursors().draw_viewport_foreground(p, rect()); @@ -228,10 +230,10 @@ bool Viewport::touchEvent(QTouchEvent *event) void Viewport::on_signals_changed() { - const vector< shared_ptr > traces(_view.get_traces()); - for (shared_ptr t : traces) { - assert(t); - connect(t.get(), SIGNAL(visibility_changed()), + const vector< shared_ptr > row_items(_view.child_items()); + for (shared_ptr r : row_items) { + assert(r); + connect(r.get(), SIGNAL(visibility_changed()), this, SLOT(update())); } }