From: Soeren Apel Date: Tue, 18 Jul 2017 15:51:01 +0000 (+0200) Subject: Rename ViewItem::point() to ViewItem::drag_point() for clarity X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a3d5a7c7682ebb991718b49ae916c5840b3b6b51;p=pulseview.git Rename ViewItem::point() to ViewItem::drag_point() for clarity --- diff --git a/pv/views/trace/cursorpair.cpp b/pv/views/trace/cursorpair.cpp index 9a874405..2ddecb27 100644 --- a/pv/views/trace/cursorpair.cpp +++ b/pv/views/trace/cursorpair.cpp @@ -73,9 +73,9 @@ float CursorPair::get_x() const return (first_->get_x() + second_->get_x()) / 2.0f; } -QPoint CursorPair::point(const QRect &rect) const +QPoint CursorPair::drag_point(const QRect &rect) const { - return first_->point(rect); + return first_->drag_point(rect); } pv::widgets::Popup* CursorPair::create_popup(QWidget *parent) diff --git a/pv/views/trace/cursorpair.hpp b/pv/views/trace/cursorpair.hpp index 7a73e198..5d53bacf 100644 --- a/pv/views/trace/cursorpair.hpp +++ b/pv/views/trace/cursorpair.hpp @@ -71,7 +71,7 @@ public: float get_x() const override; - QPoint point(const QRect &rect) const override; + QPoint drag_point(const QRect &rect) const override; pv::widgets::Popup* create_popup(QWidget *parent) override; diff --git a/pv/views/trace/flag.cpp b/pv/views/trace/flag.cpp index 1db843e0..f5579ca1 100644 --- a/pv/views/trace/flag.cpp +++ b/pv/views/trace/flag.cpp @@ -66,7 +66,7 @@ pv::widgets::Popup* Flag::create_popup(QWidget *parent) Popup *const popup = TimeMarker::create_popup(parent); popup->set_position(parent->mapToGlobal( - point(parent->rect())), Popup::Bottom); + drag_point(parent->rect())), Popup::Bottom); QFormLayout *const form = (QFormLayout*)popup->layout(); diff --git a/pv/views/trace/header.cpp b/pv/views/trace/header.cpp index 58096dc0..10fc7eb9 100644 --- a/pv/views/trace/header.cpp +++ b/pv/views/trace/header.cpp @@ -103,7 +103,7 @@ void Header::paintEvent(QPaintEvent*) stable_sort(items.begin(), items.end(), [](const shared_ptr &a, const shared_ptr &b) { - return a->point(QRect()).y() < b->point(QRect()).y(); }); + return a->drag_point(QRect()).y() < b->drag_point(QRect()).y(); }); QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); diff --git a/pv/views/trace/signalscalehandle.cpp b/pv/views/trace/signalscalehandle.cpp index 11f9bdef..b7bd85fb 100644 --- a/pv/views/trace/signalscalehandle.cpp +++ b/pv/views/trace/signalscalehandle.cpp @@ -62,9 +62,9 @@ void SignalScaleHandle::drag_by(const QPoint &delta) owner_.owner()->row_item_appearance_changed(true, true); } -QPoint SignalScaleHandle::point(const QRect &rect) const +QPoint SignalScaleHandle::drag_point(const QRect &rect) const { - return owner_.point(rect) + QPoint(0, owner_.scale_handle_offset()); + return owner_.drag_point(rect) + QPoint(0, owner_.scale_handle_offset()); } QRectF SignalScaleHandle::hit_box_rect(const ViewItemPaintParams &pp) const diff --git a/pv/views/trace/signalscalehandle.hpp b/pv/views/trace/signalscalehandle.hpp index 54eb59e8..4b256a04 100644 --- a/pv/views/trace/signalscalehandle.hpp +++ b/pv/views/trace/signalscalehandle.hpp @@ -67,7 +67,7 @@ public: * Get the drag point. * @param rect the rectangle of the widget area. */ - QPoint point(const QRect &rect) const; + QPoint drag_point(const QRect &rect) const; /** * Computes the outline rectangle of the viewport hit-box. diff --git a/pv/views/trace/timemarker.cpp b/pv/views/trace/timemarker.cpp index 487496d9..0718f3cc 100644 --- a/pv/views/trace/timemarker.cpp +++ b/pv/views/trace/timemarker.cpp @@ -78,7 +78,7 @@ float TimeMarker::get_x() const return roundf(((time_ - view_.offset()) / view_.scale()).convert_to()) + 0.5f; } -QPoint TimeMarker::point(const QRect &rect) const +QPoint TimeMarker::drag_point(const QRect &rect) const { return QPoint(get_x(), rect.bottom()); } @@ -171,7 +171,7 @@ pv::widgets::Popup* TimeMarker::create_popup(QWidget *parent) Popup *const popup = new Popup(parent); popup->set_position(parent->mapToGlobal( - point(parent->rect())), Popup::Bottom); + drag_point(parent->rect())), Popup::Bottom); QFormLayout *const form = new QFormLayout(popup); popup->setLayout(form); diff --git a/pv/views/trace/timemarker.hpp b/pv/views/trace/timemarker.hpp index 7c49948b..24ba9b03 100644 --- a/pv/views/trace/timemarker.hpp +++ b/pv/views/trace/timemarker.hpp @@ -74,7 +74,7 @@ public: * Gets the arrow-tip point of the time marker. * @param rect the rectangle of the ruler area. */ - QPoint point(const QRect &rect) const override; + QPoint drag_point(const QRect &rect) const override; /** * Computes the outline rectangle of a label. diff --git a/pv/views/trace/trace.cpp b/pv/views/trace/trace.cpp index 46d9edb9..774351c6 100644 --- a/pv/views/trace/trace.cpp +++ b/pv/views/trace/trace.cpp @@ -134,7 +134,7 @@ pv::widgets::Popup* Trace::create_popup(QWidget *parent) popup_ = new Popup(parent); popup_->set_position(parent->mapToGlobal( - point(parent->rect())), Popup::Right); + drag_point(parent->rect())), Popup::Right); create_popup_form(); diff --git a/pv/views/trace/tracetreeitem.cpp b/pv/views/trace/tracetreeitem.cpp index 470b6ad3..31b43ca1 100644 --- a/pv/views/trace/tracetreeitem.cpp +++ b/pv/views/trace/tracetreeitem.cpp @@ -133,7 +133,7 @@ void TraceTreeItem::drag_by(const QPoint &delta) owner_->owner_visual_v_offset()); } -QPoint TraceTreeItem::point(const QRect &rect) const +QPoint TraceTreeItem::drag_point(const QRect &rect) const { return QPoint(rect.right(), get_visual_y()); } diff --git a/pv/views/trace/tracetreeitem.hpp b/pv/views/trace/tracetreeitem.hpp index 7a4bf462..3605aa1a 100644 --- a/pv/views/trace/tracetreeitem.hpp +++ b/pv/views/trace/tracetreeitem.hpp @@ -111,7 +111,7 @@ public: * Gets the arrow-tip point of the row item marker. * @param rect the rectangle of the header area. */ - QPoint point(const QRect &rect) const; + QPoint drag_point(const QRect &rect) const; /** * Computes the vertical extents of the contents of this row item. diff --git a/pv/views/trace/triggermarker.cpp b/pv/views/trace/triggermarker.cpp index 31afba1c..2ef4b6ba 100644 --- a/pv/views/trace/triggermarker.cpp +++ b/pv/views/trace/triggermarker.cpp @@ -60,7 +60,7 @@ float TriggerMarker::get_x() const return ((time_ - view_.offset()) / view_.scale()).convert_to(); } -QPoint TriggerMarker::point(const QRect &rect) const +QPoint TriggerMarker::drag_point(const QRect &rect) const { return QPoint(get_x(), rect.bottom()); } diff --git a/pv/views/trace/triggermarker.hpp b/pv/views/trace/triggermarker.hpp index 09017c0b..dc9c0e93 100644 --- a/pv/views/trace/triggermarker.hpp +++ b/pv/views/trace/triggermarker.hpp @@ -67,7 +67,7 @@ public: * Gets the arrow-tip point of the time marker. * @param rect the rectangle of the ruler area. */ - QPoint point(const QRect &rect) const override; + QPoint drag_point(const QRect &rect) const override; /** * Paints the foreground layer of the item with a QPainter diff --git a/pv/views/trace/viewitem.cpp b/pv/views/trace/viewitem.cpp index 61bc99f5..445f1795 100644 --- a/pv/views/trace/viewitem.cpp +++ b/pv/views/trace/viewitem.cpp @@ -62,7 +62,7 @@ bool ViewItem::dragging() const void ViewItem::drag() { if (is_draggable()) - drag_point_ = point(QRect()); + drag_point_ = drag_point(QRect()); } void ViewItem::drag_release() diff --git a/pv/views/trace/viewitem.hpp b/pv/views/trace/viewitem.hpp index e1cc2004..39cf0345 100644 --- a/pv/views/trace/viewitem.hpp +++ b/pv/views/trace/viewitem.hpp @@ -98,7 +98,7 @@ public: * Get the drag point. * @param rect the rectangle of the widget area. */ - virtual QPoint point(const QRect &rect) const = 0; + virtual QPoint drag_point(const QRect &rect) const = 0; /** * Computes the outline rectangle of a label. diff --git a/pv/views/trace/viewport.cpp b/pv/views/trace/viewport.cpp index 8eb32a5e..e9a9df0c 100644 --- a/pv/views/trace/viewport.cpp +++ b/pv/views/trace/viewport.cpp @@ -165,7 +165,7 @@ void Viewport::paintEvent(QPaintEvent*) stable_sort(row_items.begin(), row_items.end(), [](const shared_ptr &a, const shared_ptr &b) { - return a->point(QRect()).y() < b->point(QRect()).y(); }); + return a->drag_point(QRect()).y() < b->drag_point(QRect()).y(); }); const vector< shared_ptr > time_items(view_.time_items()); assert(none_of(time_items.begin(), time_items.end(),