]> sigrok.org Git - pulseview.git/commitdiff
Trace: Converted on_hover_point_changed signal to direct notification
authorJoel Holdsworth <redacted>
Tue, 18 Nov 2014 20:10:26 +0000 (20:10 +0000)
committerJoel Holdsworth <redacted>
Wed, 19 Nov 2014 10:22:41 +0000 (10:22 +0000)
pv/view/decodetrace.h
pv/view/trace.cpp
pv/view/trace.h
pv/view/view.cpp
pv/view/view.h

index 0ff75dea641c330ef0ece9935387712b90d89d3f..96008b2b135503c41fa5193d24616b43b04e9718 100644 (file)
@@ -160,8 +160,6 @@ private:
 
        void hide_hover_annotation();
 
-       void hover_point_changed();
-
        void create_decoder_form(int index,
                std::shared_ptr<pv::data::decode::Decoder> &dec,
                QWidget *parent, QFormLayout *form);
@@ -175,6 +173,9 @@ private:
 
        void commit_channels();
 
+public:
+       void hover_point_changed();
+
 private Q_SLOTS:
        void on_new_decode_data();
 
index 61a002bb80f422a042f300c9d01526b04d810730..799a1fe3fac5d70ac421b68c35e690c69c129e85 100644 (file)
@@ -83,15 +83,7 @@ void Trace::set_v_offset(int v_offset)
 void Trace::set_view(pv::view::View *view)
 {
        assert(view);
-
-       if (_view)
-               disconnect(_view, SIGNAL(hover_point_changed()),
-                       this, SLOT(on_hover_point_changed()));
-
        _view = view;
-
-       connect(view, SIGNAL(hover_point_changed()),
-               this, SLOT(on_hover_point_changed()));
 }
 
 void Trace::paint_back(QPainter &p, int left, int right)
@@ -228,6 +220,10 @@ QRectF Trace::get_label_rect(int right)
                label_size.width(), label_size.height());
 }
 
+void Trace::hover_point_changed()
+{
+}
+
 QColor Trace::get_text_colour() const
 {
        return (_colour.lightness() > 64) ? Qt::black : Qt::white;
@@ -280,10 +276,6 @@ void Trace::populate_popup_form(QWidget *parent, QFormLayout *form)
        add_colour_option(parent, form);
 }
 
-void Trace::hover_point_changed()
-{
-}
-
 void Trace::on_popup_closed()
 {
        _popup = NULL;
@@ -302,10 +294,5 @@ void Trace::on_colour_changed(const QColor &colour)
        colour_changed();
 }
 
-void Trace::on_hover_point_changed()
-{
-       hover_point_changed();
-}
-
 } // namespace view
 } // namespace pv
index 5f54ea1ddb0e16bcb35393a415e29b97eae8c00a..7053f9ecbd0757b956c894da83108f9c0b5c82e2 100644 (file)
@@ -147,6 +147,9 @@ public:
         */
        QRectF get_label_rect(int right);
 
+public:
+       virtual void hover_point_changed();
+
 protected:
 
        /**
@@ -172,8 +175,6 @@ protected:
 
        virtual void populate_popup_form(QWidget *parent, QFormLayout *form);
 
-       virtual void hover_point_changed();
-
 private Q_SLOTS:
        void on_text_changed(const QString &text);
 
@@ -181,8 +182,6 @@ private Q_SLOTS:
 
        void on_popup_closed();
 
-       void on_hover_point_changed();
-
 Q_SIGNALS:
        void visibility_changed();
        void text_changed();    
index 1f1bd9acea32cd54c2873f5f1f8259d6f852ce0f..af0892b81d1fb4d85003b179ce38f99d72369676 100644 (file)
@@ -119,6 +119,9 @@ View::View(SigSession &session, QWidget *parent) :
        connect(_cursorheader, SIGNAL(selection_changed()),
                this, SIGNAL(selection_changed()));
 
+       connect(this, SIGNAL(hover_point_changed()),
+               this, SLOT(on_hover_point_changed()));
+
        setViewport(_viewport);
 
        _viewport->installEventFilter(this);
@@ -562,5 +565,12 @@ void View::on_geometry_updated()
        update_layout();
 }
 
+void View::on_hover_point_changed()
+{
+       const vector< shared_ptr<Trace> > traces(get_traces());
+       for (shared_ptr<Trace> t : traces)
+               t->hover_point_changed();
+}
+
 } // namespace view
 } // namespace pv
index 2fb9e7ff9ac646a7e7c012ae3dd9ae6ddf6dd25f..8229fbd25002b46f2acac89dc44682f1d4a52f21 100644 (file)
@@ -189,6 +189,8 @@ private Q_SLOTS:
 
        void on_geometry_updated();
 
+       void on_hover_point_changed();
+
 private:
        SigSession &_session;