]> sigrok.org Git - pulseview.git/commitdiff
ViewItem: Added rect parameter to point()
authorJoel Holdsworth <redacted>
Sat, 20 Dec 2014 22:39:18 +0000 (22:39 +0000)
committerJoel Holdsworth <redacted>
Mon, 29 Dec 2014 11:56:00 +0000 (11:56 +0000)
pv/view/cursorpair.cpp
pv/view/cursorpair.hpp
pv/view/rowitem.cpp
pv/view/rowitem.hpp
pv/view/timemarker.cpp
pv/view/timemarker.hpp
pv/view/viewitem.cpp
pv/view/viewitem.hpp

index 5df658dbf31cdff74cc9f789552634d75db50dc0..ea60b6ce1191415f6c6ef449c19846e4145193f3 100644 (file)
@@ -71,9 +71,9 @@ float CursorPair::get_x() const
        return (first_->get_x() + second_->get_x()) / 2.0f;
 }
 
-QPoint CursorPair::point() const
+QPoint CursorPair::point(const QRect &rect) const
 {
-       return first_->point();
+       return first_->point(rect);
 }
 
 pv::widgets::Popup* CursorPair::create_popup(QWidget *parent)
index 7e089083f0d34ecb426c8b2de3977cc799a01934..4361784a7a0a3d43e4e730add4217269bcb23b67 100644 (file)
@@ -68,7 +68,7 @@ public:
 
        float get_x() const;
 
-       QPoint point() const;
+       QPoint point(const QRect &rect) const;
 
        pv::widgets::Popup* create_popup(QWidget *parent);
 
index be694a970503e98b7d4fa718ecb27944235a1bd2..eeb727ccc966cffa86eccbedcf00dc076ade7136 100644 (file)
@@ -115,9 +115,9 @@ int RowItem::get_visual_y() const
        return visual_v_offset_ + owner_->owner_visual_v_offset();
 }
 
-QPoint RowItem::point() const
+QPoint RowItem::point(const QRect &rect) const
 {
-       return QPoint(0, visual_v_offset());
+       return QPoint(rect.right(), visual_v_offset());
 }
 
 void RowItem::hover_point_changed()
index d30227830e73782c4427dad7df1e19f76380297e..3f2afbc3821c9598b04f3d8bf5dbc04e81d72143 100644 (file)
@@ -94,9 +94,10 @@ public:
        int get_visual_y() const;
 
        /**
-        * Gets the drag point of the row item.
+        * Gets the arrow-tip point of the row item marker.
+        * @param rect the rectangle of the header area.
         */
-       QPoint point() const;
+       QPoint point(const QRect &rect) const;
 
        /**
         * Computes the vertical extents of the contents of this row item.
index 614275cf98e04d1d559d211cae6bf9740f595b15..5b21bfd84b7012025abe59cdca5f5877491be552 100644 (file)
@@ -74,9 +74,9 @@ float TimeMarker::get_x() const
        return (time_ - view_.offset()) / view_.scale();
 }
 
-QPoint TimeMarker::point() const
+QPoint TimeMarker::point(const QRect &rect) const
 {
-       return QPoint(get_x(), 0);
+       return QPoint(get_x(), rect.right());
 }
 
 QRectF TimeMarker::label_rect(const QRectF &rect) const
index 4e5d92e6c6a75efee20a0283b36676c6d8d4cb86..4f7361bd13acb5a9e119e30183c8f82a5a0a92d0 100644 (file)
@@ -67,9 +67,10 @@ public:
        float get_x() const;
 
        /**
-        * Gets the drag point of the row item.
+        * Gets the arrow-tip point of the time marker.
+        * @param rect the rectangle of the ruler area.
         */
-       QPoint point() const;
+       QPoint point(const QRect &rect) const;
 
        /**
         * Computes the outline rectangle of a label.
index ae5c427aff426acae5db7baa319567f5e13cda41..6917190a46dbd8e60554cc241219a2fc62de4743 100644 (file)
@@ -61,7 +61,7 @@ QPoint ViewItem::drag_point() const
 
 void ViewItem::drag()
 {
-       drag_point_ = point();
+       drag_point_ = point(QRect());
 }
 
 void ViewItem::drag_release()
index 1e02ffde289514bac8bf816aef3532ea46630e5f..11efbc0cdd1f7bd79855b7fe4c77cc67583f8922 100644 (file)
@@ -88,8 +88,9 @@ public:
 
        /**
         * Get the drag point.
+        * @param rect the rectangle of the widget area.
         */
-       virtual QPoint point() const = 0;
+       virtual QPoint point(const QRect &rect) const = 0;
 
        /**
         * Computes the outline rectangle of a label.