From: Joel Holdsworth Date: Mon, 13 May 2013 21:42:09 +0000 (+0100) Subject: Added clear_selection to Ruler and Header X-Git-Tag: pulseview-0.2.0~352 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=a2ae0205f2737dfd8f7647f9eae2fdcb47a0ad25 Added clear_selection to Ruler and Header --- diff --git a/pv/view/header.cpp b/pv/view/header.cpp index 8fb5b4bd..cb161a69 100644 --- a/pv/view/header.cpp +++ b/pv/view/header.cpp @@ -78,6 +78,18 @@ boost::shared_ptr Header::get_mouse_over_signal( return shared_ptr(); } +void Header::clear_selection() +{ + const vector< shared_ptr > sigs( + _view.session().get_signals()); + BOOST_FOREACH(const shared_ptr s, sigs) { + assert(s); + s->select(false); + } + + update(); +} + void Header::paintEvent(QPaintEvent*) { const int w = width(); diff --git a/pv/view/header.h b/pv/view/header.h index 504011b6..cb1d3624 100644 --- a/pv/view/header.h +++ b/pv/view/header.h @@ -46,6 +46,8 @@ private: boost::shared_ptr get_mouse_over_signal( const QPoint &pt); + void clear_selection(); + private: void paintEvent(QPaintEvent *event); diff --git a/pv/view/marginwidget.h b/pv/view/marginwidget.h index 239692ca..6f2effcf 100644 --- a/pv/view/marginwidget.h +++ b/pv/view/marginwidget.h @@ -35,6 +35,9 @@ class MarginWidget : public QWidget public: MarginWidget(pv::view::View &parent); +public slots: + virtual void clear_selection() = 0; + protected: pv::view::View &_view; }; diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index 654e6f45..049cc4af 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -58,6 +58,14 @@ Ruler::Ruler(View &parent) : this, SLOT(hover_point_changed())); } +void Ruler::clear_selection() +{ + CursorPair &cursors = _view.cursors(); + cursors.first().select(false); + cursors.second().select(false); + update(); +} + QString Ruler::format_time(double t, unsigned int prefix, unsigned int precision) { diff --git a/pv/view/ruler.h b/pv/view/ruler.h index 461ec05c..ba03f312 100644 --- a/pv/view/ruler.h +++ b/pv/view/ruler.h @@ -45,6 +45,8 @@ private: public: Ruler(View &parent); + void clear_selection(); + static QString format_time(double t, unsigned int prefix, unsigned precision = 0);