From: Joel Holdsworth Date: Mon, 27 Oct 2014 19:00:35 +0000 (+0000) Subject: View: Replaced signals_changed handler with signals_updated call X-Git-Tag: pulseview-0.3.0~463 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=14009012e02866aa8e8d338026901d180d00fcc6;p=pulseview.git View: Replaced signals_changed handler with signals_updated call --- diff --git a/pv/view/header.cpp b/pv/view/header.cpp index f3849fbe..cda08489 100644 --- a/pv/view/header.cpp +++ b/pv/view/header.cpp @@ -55,9 +55,6 @@ Header::Header(View &parent) : setFocusPolicy(Qt::ClickFocus); setMouseTracking(true); - connect(&_view.session(), SIGNAL(signals_changed()), - this, SLOT(on_signals_changed())); - connect(&_view, SIGNAL(signals_moved()), this, SLOT(on_signals_moved())); } @@ -87,6 +84,15 @@ void Header::clear_selection() update(); } +void Header::signals_updated() +{ + for (shared_ptr r : _view) { + assert(r); + connect(r.get(), SIGNAL(appearance_changed()), + this, SLOT(on_trace_changed())); + } +} + void Header::show_popup(const shared_ptr &item) { using pv::widgets::Popup; @@ -273,19 +279,6 @@ void Header::keyPressEvent(QKeyEvent *e) } } -void Header::on_signals_changed() -{ - for (shared_ptr r : _view) { - assert(r); - connect(r.get(), SIGNAL(visibility_changed()), - this, SLOT(on_trace_changed())); - connect(r.get(), SIGNAL(text_changed()), - this, SLOT(on_trace_changed())); - connect(r.get(), SIGNAL(colour_changed()), - this, SLOT(update())); - } -} - void Header::on_signals_moved() { update(); diff --git a/pv/view/header.h b/pv/view/header.h index 319f234e..76899b3a 100644 --- a/pv/view/header.h +++ b/pv/view/header.h @@ -51,6 +51,8 @@ public: */ static const int BaselineOffset; + void signals_updated(); + private: std::shared_ptr get_mouse_over_row_item( const QPoint &pt); @@ -76,8 +78,6 @@ private: void keyPressEvent(QKeyEvent *e); private Q_SLOTS: - void on_signals_changed(); - void on_signals_moved(); void on_trace_changed(); diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 035b7803..f754868c 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -522,6 +522,10 @@ void View::signals_changed() update_layout(); normalize_layout(); + + // Update the child widgets + _header->signals_updated(); + _viewport->signals_updated(); } void View::data_updated() diff --git a/pv/view/viewport.cpp b/pv/view/viewport.cpp index 22171405..8963e047 100644 --- a/pv/view/viewport.cpp +++ b/pv/view/viewport.cpp @@ -52,9 +52,6 @@ Viewport::Viewport(View &parent) : setAutoFillBackground(true); setBackgroundRole(QPalette::Base); - connect(&_view.session(), SIGNAL(signals_changed()), - this, SLOT(on_signals_changed())); - connect(&_view, SIGNAL(signals_moved()), this, SLOT(on_signals_moved())); } @@ -67,6 +64,15 @@ int Viewport::get_total_height() const return h; } +void Viewport::signals_updated() +{ + for (shared_ptr r : _view) { + assert(r); + connect(r.get(), SIGNAL(appearance_changed()), + this, SLOT(update())); + } +} + void Viewport::paintEvent(QPaintEvent*) { vector< shared_ptr > row_items(_view.begin(), _view.end()); @@ -225,15 +231,6 @@ bool Viewport::touchEvent(QTouchEvent *event) return true; } -void Viewport::on_signals_changed() -{ - for (shared_ptr r : _view) { - assert(r); - connect(r.get(), SIGNAL(appearance_changed()), - this, SLOT(update())); - } -} - void Viewport::on_signals_moved() { update(); diff --git a/pv/view/viewport.h b/pv/view/viewport.h index 10b88b4c..1f8f8f61 100644 --- a/pv/view/viewport.h +++ b/pv/view/viewport.h @@ -43,6 +43,8 @@ public: int get_total_height() const; + void signals_updated(); + protected: void paintEvent(QPaintEvent *event); @@ -56,7 +58,6 @@ private: bool touchEvent(QTouchEvent *e); private Q_SLOTS: - void on_signals_changed(); void on_signals_moved(); private: