From: Joel Holdsworth Date: Tue, 18 Nov 2014 20:10:26 +0000 (+0000) Subject: Trace: Converted on_hover_point_changed signal to direct notification X-Git-Tag: pulseview-0.3.0~494 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=33c62f44b72abab27bc141d66712ff0d1a2e395f;p=pulseview.git Trace: Converted on_hover_point_changed signal to direct notification --- diff --git a/pv/view/decodetrace.h b/pv/view/decodetrace.h index 0ff75dea..96008b2b 100644 --- a/pv/view/decodetrace.h +++ b/pv/view/decodetrace.h @@ -160,8 +160,6 @@ private: void hide_hover_annotation(); - void hover_point_changed(); - void create_decoder_form(int index, std::shared_ptr &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(); diff --git a/pv/view/trace.cpp b/pv/view/trace.cpp index 61a002bb..799a1fe3 100644 --- a/pv/view/trace.cpp +++ b/pv/view/trace.cpp @@ -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 diff --git a/pv/view/trace.h b/pv/view/trace.h index 5f54ea1d..7053f9ec 100644 --- a/pv/view/trace.h +++ b/pv/view/trace.h @@ -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(); diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 1f1bd9ac..af0892b8 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -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 > traces(get_traces()); + for (shared_ptr t : traces) + t->hover_point_changed(); +} + } // namespace view } // namespace pv diff --git a/pv/view/view.h b/pv/view/view.h index 2fb9e7ff..8229fbd2 100644 --- a/pv/view/view.h +++ b/pv/view/view.h @@ -189,6 +189,8 @@ private Q_SLOTS: void on_geometry_updated(); + void on_hover_point_changed(); + private: SigSession &_session;