From: Soeren Apel Date: Tue, 19 Sep 2017 05:48:36 +0000 (+0200) Subject: Adjust trace view header width when signal names change X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=00c518d66a61f28609b0eeddd0ce375d0002da94;p=pulseview.git Adjust trace view header width when signal names change This change is primarily needed because before, newly created decode signals had a name assigned to them at time of the constructor call. This changed, and now the name is empty upon creation, breaking the previously working header size adjustment. --- diff --git a/pv/views/trace/view.cpp b/pv/views/trace/view.cpp index 8e6bd6f4..26976866 100644 --- a/pv/views/trace/view.cpp +++ b/pv/views/trace/view.cpp @@ -253,6 +253,9 @@ void View::add_signal(const shared_ptr signal) { ViewBase::add_signalbase(signal->base()); signals_.insert(signal); + + connect(signal->base().get(), SIGNAL(name_changed(const QString&)), + this, SLOT(on_signal_name_changed())); } #ifdef ENABLE_DECODE @@ -266,6 +269,9 @@ void View::add_decode_signal(shared_ptr signal) shared_ptr d( new DecodeTrace(session_, signal, decode_traces_.size())); decode_traces_.push_back(d); + + connect(signal.get(), SIGNAL(name_changed(const QString&)), + this, SLOT(on_signal_name_changed())); } void View::remove_decode_signal(shared_ptr signal) @@ -1087,6 +1093,12 @@ void View::extents_changed(bool horz, bool vert) lazy_event_handler_.start(); } +void View::on_signal_name_changed() +{ + if (!header_was_shrunk()) + expand_header_to_fit(); +} + void View::on_splitter_moved() { // Setting the maximum width of the header widget doesn't work as diff --git a/pv/views/trace/view.hpp b/pv/views/trace/view.hpp index fa54c068..2b7e4a45 100644 --- a/pv/views/trace/view.hpp +++ b/pv/views/trace/view.hpp @@ -357,6 +357,7 @@ public: private Q_SLOTS: + void on_signal_name_changed(); void on_splitter_moved(); void h_scroll_value_changed(int value);