]> sigrok.org Git - pulseview.git/commitdiff
Adjust trace view header width when signal names change
authorSoeren Apel <redacted>
Tue, 19 Sep 2017 05:48:36 +0000 (07:48 +0200)
committerSoeren Apel <redacted>
Fri, 22 Sep 2017 19:13:48 +0000 (21:13 +0200)
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.

pv/views/trace/view.cpp
pv/views/trace/view.hpp

index 8e6bd6f405164d69dfe60f55f40dde007fd15c2d..269768669a5a44b8c94ac30c8ee7cbc9d2a2252f 100644 (file)
@@ -253,6 +253,9 @@ void View::add_signal(const shared_ptr<Signal> 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<data::DecodeSignal> signal)
        shared_ptr<DecodeTrace> 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<data::DecodeSignal> 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
index fa54c068965d7245a17fb69fa3af308a03d50df9..2b7e4a45c6ef3c71ee08e88f4695b19a5b801a55 100644 (file)
@@ -357,6 +357,7 @@ public:
 
 private Q_SLOTS:
 
+       void on_signal_name_changed();
        void on_splitter_moved();
 
        void h_scroll_value_changed(int value);