From: Joel Holdsworth Date: Sat, 20 Dec 2014 22:39:18 +0000 (+0000) Subject: ViewItem: Added rect parameter to point() X-Git-Tag: pulseview-0.3.0~322 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=be7170664b80552fdfb38da1c214c271cbf116aa;p=pulseview.git ViewItem: Added rect parameter to point() --- diff --git a/pv/view/cursorpair.cpp b/pv/view/cursorpair.cpp index 5df658db..ea60b6ce 100644 --- a/pv/view/cursorpair.cpp +++ b/pv/view/cursorpair.cpp @@ -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) diff --git a/pv/view/cursorpair.hpp b/pv/view/cursorpair.hpp index 7e089083..4361784a 100644 --- a/pv/view/cursorpair.hpp +++ b/pv/view/cursorpair.hpp @@ -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); diff --git a/pv/view/rowitem.cpp b/pv/view/rowitem.cpp index be694a97..eeb727cc 100644 --- a/pv/view/rowitem.cpp +++ b/pv/view/rowitem.cpp @@ -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() diff --git a/pv/view/rowitem.hpp b/pv/view/rowitem.hpp index d3022783..3f2afbc3 100644 --- a/pv/view/rowitem.hpp +++ b/pv/view/rowitem.hpp @@ -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. diff --git a/pv/view/timemarker.cpp b/pv/view/timemarker.cpp index 614275cf..5b21bfd8 100644 --- a/pv/view/timemarker.cpp +++ b/pv/view/timemarker.cpp @@ -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 diff --git a/pv/view/timemarker.hpp b/pv/view/timemarker.hpp index 4e5d92e6..4f7361bd 100644 --- a/pv/view/timemarker.hpp +++ b/pv/view/timemarker.hpp @@ -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. diff --git a/pv/view/viewitem.cpp b/pv/view/viewitem.cpp index ae5c427a..6917190a 100644 --- a/pv/view/viewitem.cpp +++ b/pv/view/viewitem.cpp @@ -61,7 +61,7 @@ QPoint ViewItem::drag_point() const void ViewItem::drag() { - drag_point_ = point(); + drag_point_ = point(QRect()); } void ViewItem::drag_release() diff --git a/pv/view/viewitem.hpp b/pv/view/viewitem.hpp index 1e02ffde..11efbc0c 100644 --- a/pv/view/viewitem.hpp +++ b/pv/view/viewitem.hpp @@ -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.