]> sigrok.org Git - pulseview.git/commitdiff
TimeItem: Added mandatory get_x virtual method
authorJoel Holdsworth <redacted>
Mon, 8 Dec 2014 22:46:37 +0000 (22:46 +0000)
committerUwe Hermann <redacted>
Wed, 10 Dec 2014 17:06:16 +0000 (18:06 +0100)
pv/view/cursorpair.cpp
pv/view/cursorpair.hpp
pv/view/timeitem.hpp

index 48109db8f92c9bac2e97240a37d7629d42b51b18..f9f7ba21ea93faa865653914086e2b4718d3b23b 100644 (file)
@@ -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();
index 2c4d5c1c70be67a37a176b38fa41e21811a8a24c..43e06545ad4fd94cfe6690dc473906fa9fd3d910 100644 (file)
@@ -65,6 +65,8 @@ public:
         */
        void set_time(double time);
 
+       float get_x() const;
+
        QPoint point() const;
 
        pv::widgets::Popup* create_popup(QWidget *parent);
index eb313a7ec6825d379d011c1ec12a358cf8b86254..ff2664a664b17a7163574c446a217304845406a3 100644 (file)
@@ -45,6 +45,8 @@ public:
         */
        virtual void set_time(double time) = 0;
 
+       virtual float get_x() const = 0;
+
 protected:
        View &view_;
 };