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<Signal> s,
- _view.session().get_signals()) {
+ int h = 0;
+ const vector< shared_ptr<Signal> > sigs(
+ _view.session().get_signals());
+ BOOST_FOREACH(const shared_ptr<Signal> 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<Signal> > &sigs =
- _view.session().get_signals();
+ const vector< shared_ptr<Signal> > sigs(
+ _view.session().get_signals());
QPainter p(this);
p.setRenderHint(QPainter::Antialiasing);
cursors.second.paint(p, r);
}
+void Viewport::on_signals_moved()
+{
+ update();
+}
+
} // namespace view
} // namespace pv