]> sigrok.org Git - pulseview.git/commitdiff
View: Replaced signals_changed handler with signals_updated call
authorJoel Holdsworth <redacted>
Mon, 27 Oct 2014 19:00:35 +0000 (19:00 +0000)
committerJoel Holdsworth <redacted>
Wed, 19 Nov 2014 10:23:02 +0000 (10:23 +0000)
pv/view/header.cpp
pv/view/header.h
pv/view/view.cpp
pv/view/viewport.cpp
pv/view/viewport.h

index f3849fbe3f1db3ad3005a14273a1a00a9ea434ec..cda0848984a8cbf3d3ae144b5dc139703e929c5c 100644 (file)
@@ -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<RowItem> r : _view) {
+               assert(r);
+               connect(r.get(), SIGNAL(appearance_changed()),
+                       this, SLOT(on_trace_changed()));
+       }
+}
+
 void Header::show_popup(const shared_ptr<RowItem> &item)
 {
        using pv::widgets::Popup;
@@ -273,19 +279,6 @@ void Header::keyPressEvent(QKeyEvent *e)
        }
 }
 
-void Header::on_signals_changed()
-{
-       for (shared_ptr<RowItem> 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();
index 319f234e255e532f4f3a016c1c78bb6c40d1c821..76899b3ab424dcc7002dae4984eb30901b6cf5e3 100644 (file)
@@ -51,6 +51,8 @@ public:
         */
        static const int BaselineOffset;
 
+       void signals_updated();
+
 private:
        std::shared_ptr<pv::view::RowItem> 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();
index 035b7803bb83b96d78101602474c8684115e22d1..f754868c96b69b4efd0bc61856fa71d946aa3071 100644 (file)
@@ -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()
index 221714051504a81a7e48b47056217d98f67e05cb..8963e047b355dc8f3f0d2d2eba30fd2cb3b92766 100644 (file)
@@ -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<RowItem> r : _view) {
+               assert(r);
+               connect(r.get(), SIGNAL(appearance_changed()),
+                       this, SLOT(update()));
+       }
+}
+
 void Viewport::paintEvent(QPaintEvent*)
 {
        vector< shared_ptr<RowItem> > 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<RowItem> r : _view) {
-               assert(r);
-               connect(r.get(), SIGNAL(appearance_changed()),
-                       this, SLOT(update()));
-       }
-}
-
 void Viewport::on_signals_moved()
 {
        update();
index 10b88b4c01d413e4d9a96fa5f1f96562d8836aed..1f8f8f61095748e4290911e1fe5caa2d4cbedd74 100644 (file)
@@ -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: