From 5165bb349b14802ca98766b4cecee3699d22fa55 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Mon, 8 Dec 2014 22:46:37 +0000 Subject: [PATCH] TimeItem: Added mandatory get_x virtual method --- pv/view/cursorpair.cpp | 5 +++++ pv/view/cursorpair.hpp | 2 ++ pv/view/timeitem.hpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/pv/view/cursorpair.cpp b/pv/view/cursorpair.cpp index 48109db..f9f7ba2 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 2c4d5c1..43e0654 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 eb313a7..ff2664a 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_; }; -- 2.30.2