X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fheader.cpp;h=a00efb14664534e689464b398040b39d302011ab;hb=f46e495ef1db0a4e522462ac18260f2151fa2b89;hp=ca5df96fca250dc23666bbdcf59f644a07083139;hpb=d7c0ca4a965c5f9cb2ae9aea584bb2547f4baca1;p=pulseview.git diff --git a/pv/view/header.cpp b/pv/view/header.cpp index ca5df96..a00efb1 100644 --- a/pv/view/header.cpp +++ b/pv/view/header.cpp @@ -36,8 +36,11 @@ #include -using namespace boost; -using namespace std; +using boost::shared_ptr; +using std::max; +using std::make_pair; +using std::pair; +using std::vector; namespace pv { namespace view { @@ -56,6 +59,10 @@ Header::Header(View &parent) : connect(&_view, SIGNAL(signals_moved()), this, SLOT(on_signals_moved())); + + // Trigger the initial event manually. The default device has signals + // which were created before this object came into being + on_signals_changed(); } QSize Header::sizeHint() const @@ -65,7 +72,10 @@ QSize Header::sizeHint() const const vector< shared_ptr > traces(_view.get_traces()); BOOST_FOREACH(shared_ptr t, traces) { assert(t); - max_width = max(max_width, (int)t->get_label_rect(0).width()); + + if (t->enabled()) { + max_width = max(max_width, (int)t->get_label_rect(0).width()); + } } return QSize(max_width + Padding, 0); @@ -213,9 +223,7 @@ void Header::mouseMoveEvent(QMouseEvent *event) const int delta = event->pos().y() - _mouse_down_point.y(); - for (std::list, - int> >::iterator i = _drag_traces.begin(); - i != _drag_traces.end(); i++) { + for (auto i = _drag_traces.begin(); i != _drag_traces.end(); i++) { const boost::shared_ptr trace((*i).first); if (trace) { const int y = (*i).second + delta; @@ -274,9 +282,9 @@ void Header::on_signals_changed() BOOST_FOREACH(shared_ptr t, traces) { assert(t); connect(t.get(), SIGNAL(visibility_changed()), - this, SLOT(update())); + this, SLOT(on_trace_changed())); connect(t.get(), SIGNAL(text_changed()), - this, SLOT(on_trace_text_changed())); + this, SLOT(on_trace_changed())); connect(t.get(), SIGNAL(colour_changed()), this, SLOT(update())); } @@ -287,7 +295,7 @@ void Header::on_signals_moved() update(); } -void Header::on_trace_text_changed() +void Header::on_trace_changed() { update(); geometry_updated();