From 3b9c4a0df39e718ba69f3c778b51676617aeb1eb Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Mon, 8 Dec 2014 22:36:54 +0000 Subject: [PATCH] TimeItem: Added mandatory set_time virtual method --- pv/view/cursorpair.cpp | 6 ++++++ pv/view/cursorpair.hpp | 5 +++++ pv/view/timeitem.hpp | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/pv/view/cursorpair.cpp b/pv/view/cursorpair.cpp index 8a0ecbf2..48109db8 100644 --- a/pv/view/cursorpair.cpp +++ b/pv/view/cursorpair.cpp @@ -59,6 +59,12 @@ shared_ptr CursorPair::second() const return second_; } +void CursorPair::set_time(double time) { + const double delta = second_->time() - first_->time(); + first_->set_time(time); + second_->set_time(time + delta); +} + QPoint CursorPair::point() const { return first_->point(); diff --git a/pv/view/cursorpair.hpp b/pv/view/cursorpair.hpp index 78780916..2c4d5c1c 100644 --- a/pv/view/cursorpair.hpp +++ b/pv/view/cursorpair.hpp @@ -60,6 +60,11 @@ public: */ std::shared_ptr second() const; + /** + * Sets the time of the marker. + */ + void set_time(double time); + QPoint point() const; pv::widgets::Popup* create_popup(QWidget *parent); diff --git a/pv/view/timeitem.hpp b/pv/view/timeitem.hpp index e47f1a6b..eb313a7e 100644 --- a/pv/view/timeitem.hpp +++ b/pv/view/timeitem.hpp @@ -39,6 +39,12 @@ protected: */ TimeItem(View &view); +public: + /** + * Sets the time of the marker. + */ + virtual void set_time(double time) = 0; + protected: View &view_; }; -- 2.30.2