From: Joel Holdsworth Date: Mon, 8 Dec 2014 22:46:37 +0000 (+0000) Subject: TimeItem: Added mandatory get_x virtual method X-Git-Tag: pulseview-0.3.0~377 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=5165bb349b14802ca98766b4cecee3699d22fa55;p=pulseview.git TimeItem: Added mandatory get_x virtual method --- diff --git a/pv/view/cursorpair.cpp b/pv/view/cursorpair.cpp index 48109db8..f9f7ba21 100644 --- a/pv/view/cursorpair.cpp +++ b/pv/view/cursorpair.cpp @@ -65,6 +65,11 @@ void CursorPair::set_time(double time) { second_->set_time(time + delta); } +float CursorPair::get_x() const +{ + return (first_->get_x() + second_->get_x()) / 2.0f; +} + QPoint CursorPair::point() const { return first_->point(); diff --git a/pv/view/cursorpair.hpp b/pv/view/cursorpair.hpp index 2c4d5c1c..43e06545 100644 --- a/pv/view/cursorpair.hpp +++ b/pv/view/cursorpair.hpp @@ -65,6 +65,8 @@ public: */ void set_time(double time); + float get_x() const; + QPoint point() const; pv::widgets::Popup* create_popup(QWidget *parent); diff --git a/pv/view/timeitem.hpp b/pv/view/timeitem.hpp index eb313a7e..ff2664a6 100644 --- a/pv/view/timeitem.hpp +++ b/pv/view/timeitem.hpp @@ -45,6 +45,8 @@ public: */ virtual void set_time(double time) = 0; + virtual float get_x() const = 0; + protected: View &view_; };