From: Joel Holdsworth Date: Sat, 20 Dec 2014 22:39:18 +0000 (+0000) Subject: ViewItem: Added rect parameter to point() X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=commitdiff_plain;h=be7170664b80552fdfb38da1c214c271cbf116aa ViewItem: Added rect parameter to point() --- diff --git a/pv/view/cursorpair.cpp b/pv/view/cursorpair.cpp index 5df658d..ea60b6c 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 7e08908..4361784 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 be694a9..eeb727c 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 d302278..3f2afbc 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 614275c..5b21bfd 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 4e5d92e..4f7361b 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 ae5c427..6917190 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 1e02ffd..11efbc0 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.